Hello there,

I am trying to understand the VirtualHost directives for Apache 2.0,
specifically with regards to specifying the port. With ServerName directive
now able to specify ports, it brings another element into the picture. Does
it make a difference if the port is specified in the <VirtualHost
my.ip.addr.here:port> or in the ServerName my.domain.here:port ? What about
if there are multiple ip addresses/ports specified in the Virtual Host? How
does that affect the ServerName? Is it best to specify the multiple ports/ip
in the VirtualHost directive and then leave the ServerName with only the
domain.name and no port?
I hope this makes sense. 

Here is an example :
            ...
            Listen 1.2.3.4:80
            Listen 1.2.3.5:8080
            ServerName server.domain.com
            
            <VirtualHost 1.2.3.4:80>    #VHOST 1
            DocumentRoot /www/domain
            ServerName www.domain.com
            ...
            </VirtualHost>

            <VirtualHost 1.2.3.5:8080>  # VHOST 2
            ServerName other.domain.com
            ...
            </VirtualHost>

Can VHOST 1 be specified instead: 
            <VirtualHost 1.2.3.4>    #VHOST 1
            DocumentRoot /www/domain
            ServerName www.domain.com:80
            ...
            </VirtualHost>

or would it be legal to do this?: 
            <VirtualHost 1.2.3.4:80 1.2.3.5:8080>    #VHOST 1 
            DocumentRoot /www/domain                  
            ServerName www.domain.com:??           #maybe no port specified?
            ...
            </VirtualHost>

Thanks in advance,
Liza

Reply via email to