0

I have the following in my httpd.conf file (snippets only):

Listen 80
Listen localhost:80

DocumentRoot "c:/web"
<Directory "c:/web">
    DirectoryIndex index.html index.php
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

My httpd-vhosts.conf file looks like this: NameVirtualHost localhost:80

<VirtualHost *:80>
    <Directory "c:\web">
        Options Indexes FollowSymLinks MultiViews Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>

    ServerName localhost
    ServerAlias localhost
    DocumentRoot "c:\web"
</VirtualHost>
 # Website ID 1 - Project ADPS
<VirtualHost *:80>
    <Directory "C:\xampp\htdocs\ADPS\">
        Options Indexes FollowSymLinks MultiViews Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
        Require all granted
    </Directory>

    ServerName ADPS.localhost
    ServerAlias ADPS.localhost
    DocumentRoot "C:\xampp\htdocs\ADPS"
</VirtualHost>

My Windows HOSTS file looks like this:

127.0.0.1   localhost
localhost   localhost
127.0.0.1   ADPS.127.0.0.1  # Website ID 1 - Project ADPS
localhost   ADPS.localhost  # Website ID 1 - Project ADPS

The issue is when ever I enter http://adps.localhost it for some reason displays the same page as it would if I had types http://localhost. There are no clues in the access.log or error.log that help me determine why this happens. I have looked at multiple links and I can't see anything wrong with my server configuration.

I have a windows 10 Machine running Apache 2.4 with PHP. I am not too worried about security of the machine as these machines will only be setup to run locally for development and not for a production state website.

1 Answers1

0

Because this was a new installation of Apache without using third party software such as XAMPP the VHost file wasn't enabled.

If you navigate to the bottom of the httpd.conf file, you will see a line like this:

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Remove the # hashtag (removing the comment) and restart your Apache. This should resolve the issue (or show new errors if there are any)