Forum Moderators: phranque

Message Too Old, No Replies

1 VirtualHost on 2 ports?

80 and 2000

         

akbigdog

9:57 pm on Jun 24, 2005 (gmt 0)

10+ Year Member



I have port 2000 open through my company's firewall to my internal testing server so that I can access it from home. httpd.conf is set to
Listen
on ports 80 and 2000. I have
NameVirtualHost
on *:80 and *:2000. And for each testing domain, I have 2
<VirtualHost>
blocks:

<VirtualHost *:80>
DocumentRoot W:\Sites\jbourne
ServerName jbourne.local
</VirtualHost>

<VirtualHost *:2000>
DocumentRoot W:\Sites\jbourne
ServerName jbourne.local
</VirtualHost>

This works, but it's not very efficient, and doesn't make changes any easier. How can I shorten this to allow a virtual host to be accessed on both ports with only 1

<VirtualHost>
block in httpd.conf?

gergoe

7:44 pm on Jun 26, 2005 (gmt 0)

10+ Year Member



What is your NameVirtualHost directive has been set to in your config?

What you can do is to set that directive to * , and change all your VirtualHost definitions to * too (and of course remove the duplicate definitions). So actually get rid of the port definitions from the VirtualHost configuration.

Read the Apache Virtual Host documentation [httpd.apache.org] for further details. Be sure to check out the Name-based Virtual Hosts first.