skip to Main Content

Environment

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

enter image description here

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

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.

3

Answers


  1. Chosen as BEST ANSWER

    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


  2. Have you updated your C:WindowsSystem32driversetchosts 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)

    Login or Signup to reply.
  3. C:WindowsSystem32driversetc

    127.0.0.1   test.local
    

    C:xamppapacheconfextrahttpd-vhosts.conf:

    <VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot "C:/wamp64/www/test"
        ServerName test.local
        <Directory "C:/wamp64/www/hydroboost/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
      </Directory>
    </VirtualHost>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search