At the moment I have this config in /etc/apache2/ports.conf
:
NameVirtualHost *:80
Listen 80
All works fine, but I want to change it to:
NameVirtualHost 127.0.0.1:80
Listen 127.0.0.1:80
However after restarting apache, it displays the following error message:
[warn] NameVirtualHost 127.0.0.1:80 has no VirtualHosts
So I've updated the website VirtualHost file under /etc/apache2/sites-available/foo.com
:
Original:
<VirtualHost *:80>
...
</VirtualHost>
Updated:
<VirtualHost 127.0.0.1:80>
...
</VirtualHost>
But after restarting apache, it shows the default apache2 index.html that is in /var/www
instead of the project under /var/www/foo
This is the only enabled VirtualHost on the server.
Also here is my /etc/hosts
file:
127.0.0.1 localhost
127.0.1.1 debian
<publicIP> <foo.com> <serverhostname>
The host OS is Debian 7.
Any suggestions?