How to enable virtual hosting with Apache.

I don’t monkey with the Apache configuration file enough to keep this information accessible in my brain. Here are some personal notes.

I set up a new LAMP server yesterday. Today I added some name-based virtual hosts to the configuration file, but was getting the following warning when restarting Apache:

[warn] _default_ VirtualHost overlap on port 80, the first has precedence

This warning was being triggered because I had not told Apache to use name-based virtual hosting. To enable name-based virtual hosting, locate and uncomment the NameVirtualHost directive in the Apache configuration file.

The Apache documentation site has information about setting up name-based virtual hosts. You can also find the details for the NameVirtualHost directive.

Leave a Reply