Environment
- XAMPP 7.2.4 installed on Windows 10
- Apache running on ports 80 and 443
Configuration
C:WindowsSystem32driversetchosts
:
127.0.0.1 www.test.local test.local
C:xamppapacheconfhttpd.conf
:
DocumentRoot "D:/htdocs"
<Directory "D:/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
C:xamppapacheconfextrahttpd-vhosts.conf
:
<VirtualHost *:80>
DocumentRoot D:/htdocs
ServerName localhost
<Directory "D:/htdocs">
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot D:/htdocs
ServerName test.local
<Directory "D:/htdocs">
Allow from all
</Directory>
</VirtualHost>
The problem
When I start Apache and I access to localhost
is all right. The problem comes when I try to reach test.local
: the browser returns a This site can’t be reached message. It’s like XAMPP ignores the custom domain vhosts defined into httpd-vhost.conf
file. The same message is displayed with the server off.
This site can’t be reached
The webpage at http://test.local/ might be temporarily down or it may have moved permanently to a new web address.
ERR_ADDRESS_INVALID
A few days ago the setup was working and the only changes that I made was the new software installation. I mean, no changes in Apache config files.
3
Answers
If all your stack were working correctly before, don't be like me and don't forget to check if some browser extension is blocking your local traffic, like some extension related with an antivirus system.
In my case it was the Kaspersky Protection extension. When something goes wrong, it shows the following graphic.
Have you updated your
C:WindowsSystem32driversetchosts
file with a mapping like this this?hosts
filelocalhost
domain works without this mapping, because the OS already recognizes “localhost” as a built in alias for the loopback IP address(this suggestion is assuming that you are running and testing on the same local machine)
C:WindowsSystem32driversetc
C:xamppapacheconfextrahttpd-vhosts.conf: