Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My currently working apache config has everything running on port 80 (the usual) but I'm adding a node proxy to the front-end and this will listen on 80 and forward to other web servers based on the host requested.

At this time my httpd.conf file is empty, the ports.conf file looks like the below

NameVirtualHost *.80
Listen 80

inside my sites-available I have config file named "blog" -that file has the specific vhost

<VirtualHost *:80>
    ServerName www.mysite.com:80
    DocumentRoot /www/blog.mysite.com/current/static

What should I modify if I just want to have apache working as it does now -except on port 9000?

The apache information is listed below -fresh install on Ubuntu 12.04

root@mybox:/etc/apache2# apache2 -v
Server version: Apache/2.2.22 (Ubuntu)

UPDATE 1

If I change each vhost and the ports.conf from :80 to :9000 and restart -apache won't serve anything on that port (note -port 80 still serves everything as you'd expect)

Do I need to modify the line *.80 in the files? if so to what? 127.0.0.1:9000 or ?

UPDATE 2

If I modify the NameVirtualHost to be *:9000 in all my vhosts / ports.conf I get the error below

root@mybox:/etc/apache2/sites-available# service apache2 restart
 * Restarting web server apache2                                                                                                                      [Sat Jul 21 12:24:56 2012] [warn] _default_ VirtualHost overlap on port 9000, the first has precedence
[Sat Jul 21 12:24:56 2012] [warn] _default_ VirtualHost overlap on port 9000, the first has precedence
[Sat Jul 21 12:24:56 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
 ... waiting [Sat Jul 21 12:24:57 2012] [warn] _default_ VirtualHost overlap on port 9000, the first has precedence
[Sat Jul 21 12:24:57 2012] [warn] _default_ VirtualHost overlap on port 9000, the first has precedence
[Sat Jul 21 12:24:57 2012] [warn] NameVirtualHost *:80 has no VirtualHosts
share|improve this question
    
Just changing 80 to 9000 does work. If your NameVirtualHost above is as it's written in yout conf file then it's wrong it should be NameVirtualHost *:80 (or 9000). Do you see any error messages when you restart or in your logs ? –  Iain Jul 21 '12 at 17:09
    
It looks like you missed an 80 somewhere. I just did this on a Ubuntu VM and it works exactly as expected. –  Iain Jul 21 '12 at 17:33
    
You are correct sir -a simple grep found that my apache2.conf file had the original *:80 configuration (thanks for your time & patience) –  Toran Billups Jul 21 '12 at 17:38

3 Answers 3

up vote 3 down vote accepted

You should just change all occurrences of 80 to 9000 and then restart your webserver.

service apache2 restart
share|improve this answer

It's pretty straightforward, change all occurrences of 80 to 9000. When configuring your proxy, you just need to point it towards port 9000.

After you made your changes, do not forget to restart your apache server:

sudo /etc/init.d/apache2 restart
share|improve this answer

Alternatively:

Add:

export VHOST_PORT_HTTP=9000

to /etc/apache2/envvars

Change:

NameVirtualHost *:80
Listen 80

to

NameVirtualHost *:${VHOST_PORT_HTTP}
Listen ${VHOST_PORT_HTTP}

in /etc/apache2/ports.conf

and at the top of each of your vhosts, use:

<VirtualHost *:${VHOST_PORT_HTTP}>

Then you can control the HTTP port of all vhosts at the same time by changing the value in /etc/apache2/envvars and restarting. Handy if you need to bypass the proxy in a hurry.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.