Forum Moderators: phranque

Message Too Old, No Replies

Listen on multiple ports

Syntax issue

         

wtb32141

9:58 pm on May 8, 2012 (gmt 0)

10+ Year Member



I am running apache2-mpm-prefork 2.2.9-10+lenny12 and the Debian configuration scheme. I want Apache to listen on 2 ports: 80 and 50002; so I need these 2 Listen directives:

Listen 80
Listen 50002

I’m hosting only 1 website; so I have the following directives to accommodate port 80.

NameVirtual Host *:80

<VirtualHost *:80>
DocumentRoot /var/www
etc.
</VirtualHost>

What must I do to this latter set of directives to add functionality for port 50002? Would the following work (i.e., is it proper syntax)?

NameVirtual Host *:80:50002

<VirtualHost *:80:50002>
DocumentRoot /var/www
etc.
</VirtualHost>

Thanks for your help.

phranque

1:08 pm on May 9, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, wtb32141!

note that the directive of NameVirtualHost - not NameVirtual Host.

Running different sites on different ports:
http://httpd.apache.org/docs/2.2/vhosts/examples.html#port

http://httpd.apache.org/docs/2.2/mod/core.html#namevirtualhost:
Note that the argument to the <VirtualHost> directive must exactly match the argument to the NameVirtualHost directive.


so probably more like:

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www
etc.
</VirtualHost>

NameVirtualHost *:50002

<VirtualHost *:50002>
DocumentRoot /var/www
etc.
</VirtualHost>