NameVirtualHost & serving on several ports in Apache on Ubuntu 10.10

published Nov 17, 2011 11:08   by admin ( last modified Nov 17, 2011 11:08 )

Today on a temporary test setup I had the need for Apache to serve out sites on the same IP number, but on different ports (due to inflexible port forwarding on a router). According to the Apache documentation, NameVirtualHost can be written without a port specification.

NameVirtualHost *

However if you do so on Ubuntu 10.10 with some virtual hosts defined with ports, you get:

[error] VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtualHost address is not supported,
proceeding with undefined results

Putting in more than one NameVirtualHost, with different port numbers covering the ports used in the virtual hosts directives, gives no errors though:

NameVirtualHost *:80

NameVirtualHost *:8080

 And seems to work. You need to tell Apache to listen to all ports specified too.