Configuring virtual domain, Apache is not happy about 127.0.0.1

  apache, virtualhost, windows

I am installing wordpress on ampps.
Created a local domain wordpress.localhost, added it to the hosts file

127.0.0.1 wordpress.localhost

This is my httpd-vhosts.conf

<VirtualHost 127.0.0.1:80>
<Directory "C:/Program Files/Ampps/www/wordpress.localhost">
Options FollowSymLinks Indexes
AllowOverride All
# Apache 2.2
<IfModule !mod_authz_core.c>
    Order deny,allow
    allow from All
</IfModule>
# Apache 2.4
<IfModule mod_authz_core.c>
    Require all granted
</IfModule>
</Directory>
ServerName wordpress.localhost
ServerAlias wordpress.localhost
ScriptAlias /cgi-bin/ "C:/Program Files/Ampps/www/wordpress.localhost/cgi-bin/"
DocumentRoot "C:/Program Files/Ampps/www/wordpress.localhost"
ErrorLog "C:/Program Files/Ampps/apache/logs/wordpress.localhost.err"
CustomLog "C:/Program Files/Ampps/apache/logs/wordpress.localhost.log" combined
</VirtualHost>

The problem is when I type in wordpress.localhost in the browser, Apache resolves it to www root, not to the wordpress.localhost .
When I replaced <VirtualHost 127.0.0.1:80> with <VirtualHost *:80> in the httpd-vhosts file it magically started working.
I ran "ping -4 wordpress.localhost" and it was perfectly resolved to 127.0.0.1
Any idea what’s wrong and why Apache is not happy about the 127.0.0.1:80 ?

Source: Windows Questions

LEAVE A COMMENT