2

Environment

  • XAMPP 7.2.4 installed on Windows 10
  • Apache running on ports 80 and 443

enter image description here

Configuration

C:\Windows\System32\drivers\etc\hosts:

127.0.0.1 www.test.local test.local

C:\xampp\apache\conf\httpd.conf:

DocumentRoot "D:/htdocs"
<Directory "D:/htdocs">
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>

C:\xampp\apache\conf\extra\httpd-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

enter image description here

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.

cespon
  • 5,630
  • 7
  • 33
  • 47

3 Answers3

2

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.

enter image description here

cespon
  • 5,630
  • 7
  • 33
  • 47
  • Haha silly me, thanks man you saved me, I was suddenly facing this weird issue and I was clueless and I forgot that I enable VPN for some reason and after that when I tried to access my local domain it can't and after searching couple of minute found your solution and it's worked for me :) thanks again – mlimon Oct 29 '20 at 07:00
1

C:\Windows\System32\drivers\etc

127.0.0.1   test.local

C:\xampp\apache\conf\extra\httpd-vhosts.conf:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "C:/wamp64/www/test"
    ServerName test.local
    <Directory "C:/wamp64/www/hydroboost/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local
  </Directory>
</VirtualHost>
Priti Rathod
  • 117
  • 1
  • 10
0

Have you updated your C:\Windows\System32\drivers\etc\hosts file with a mapping like this this?

  • add this line to the end of the hosts file
127.0.0.1 test.local
  • the localhost 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)

egnomerator
  • 985
  • 8
  • 15