How can I solve the apache2 httpd error "mixing * ports and non-* ports with a NameVirtualHost address is not supported"

The IP addresses named with NameVirtualHost have to match the IP address in each VirtualHost element.

Example:

NameVirtualHost *:80
NameVirtualHost *:81

<VirtualHost *:80>
# ...
</VirtualHost>

<VirtualHost *:81>
# ...
</VirtualHost>

# This will not work!
<VirtualHost *>
# ...
</VirtualHost>

Read the Apache Virtual Host documentation for details.


Replace this:

NameVirtualHost *

With this:

NameVirtualHost *:80

Adding to the responses, one thing that i noticed is that you can't run SSL without having explicit declaring the :80 on every NameVirtualHost and VirtualHost directives, apache won't support having:

NameVirtualHost *

and

NameVirtualHost *:443

Mixed up in the same config, you will get errors on apache listening on port zero if you do that.

For me i just added :80 to every host so SSL could work proprietly.