Forum Moderators: phranque
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?
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.