Reputation: 359
Before marking this as answered, please read the entire thing because yes there is a good amount of these questions but NONE of the answers on them have worked at all.
For the last 6 months I've looked at around 50 different form posts here and around the web to try and get my XAMPP virtual hosts working.
Hosts File
127.0.0.1 localhost
127.0.0.1 vws.localhost
127.0.0.1 instancegaming.net
127.0.0.1 vws.instancegaming.net
http-vhosts File (Updated 7/26)
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
# Use name-based virtual hosting.
#
# NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:\xampp\htdocs"
<Directory "C:\xampp\htdocs">
DirectoryIndex index.php
</Directory>
</VirtualHost>
I'm at a loss of what to do, I've tried putting all fields to localhost then to instancegaming.net but nothing seems to work. I've read the Apache log and there's only SSL errors floating around.
When I try going to [ http:// ] vws.localhost, vws.192.168.0.47, vws.instancegaming.net all of which give the same error in chrome:
ERR_NAME_NOT_RESOLVED
Then I tried emptying chromes host cache, but that didn't help either. Sidenote: I reinstalled XAMPP 4 times trying to make this work.
Upvotes: 11
Views: 50595
Reputation: 45
I fixed the problem by just restarting my computer after setting up the System32 file hosts and the apache vhosts.
Upvotes: 1
Reputation: 4022
Follow these steps if you are in windows environment (7 & 10 tested) with XAMPP:
C:\Windows\System32\drivers\etc
]127.0.0.1 vws.localhost 127.0.0.1 instancegaming.net 127.0.0.1 vws.instancegaming.net
C:\__Server\apache\conf
] . though some says there are security risks with this but couldn't find a way without this<Directory /> AllowOverride none Require all granted </Directory>
C:\__Server\apache\conf\extra
]<VirtualHost *:80> ServerName localhost DocumentRoot "C:\__Server\htdocs" <Directory "C:\__Server\htdocs"> DirectoryIndex index.php </Directory> </VirtualHost> <VirtualHost *:80> ServerName tools.com.at DocumentRoot "E:\phpStorms\git\tools-class" SetEnv APPLICATION_ENV "development" <Directory "E:\phpStorms\git\tools-class"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerName laravel.test.com.at DocumentRoot "E:\laravel.test.com.at\public" SetEnv APPLICATION_ENV "development" <Directory "E:\laravel.test.com.at\public"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
template of this
<VirtualHost *:80>
ServerName nameInHostsFile
DocumentRoot "pathOfTheWindowsFileLocationWhichWillBeDocumentRoot"
SetEnv APPLICATION_ENV "development"
<Directory "pathOfTheWindowsFileLocationWhichWillBeDocumentRoot">
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Note 1: My xampp installed on C:\__Server
location
Note 2 : My folder name is laravel.test.com.at
and its in E:
drive E:\laravel.test.com.at
Note 3: Always copy folder location from address bar in windows explorer, so there is no mistakes.
Note 4: You must restart XAMPP after editing httpd-vhosts.conf every time.
Note 5: Use uncommon part in url [i.e .com.at] so that it is unique and there is no issue resolving dns.
Update: troubleshoot@Jacob Jewett
After a fresh copy of XAMPP installation in C drive -
<VirtualHost *:80> ServerName localhost DocumentRoot "C:\xampp\htdocs" <Directory "C:\xampp\htdocs"> DirectoryIndex index.php </Directory> </VirtualHost> <VirtualHost *:80> ServerName vws.localhost DocumentRoot "C:\xampp\vws" SetEnv APPLICATION_ENV "development" <Directory "C:\xampp\vws"> DirectoryIndex index.php AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
<Directory /> AllowOverride none Require all granted </Directory>
ADD PATH
variable for php [C:\xampp\php
], and also check that there isn't another php path in the PATH
variable.
restart xampp and browse localhost
Upvotes: 21
Reputation: 321
Additionally make sure that the line
Include etc/extra/httpd-vhosts.conf
is not quoted out in httpd.conf
Upvotes: 4
Reputation: 1
If pings are successful but a Virtual Host is not working with XAMPP 7.3.1 and Windows 10 Pro the problem may be interference with the World Wide Web Publishing Service.
On my system, Apache and MySQL start successfully but the virtual host cannot be browsed till I stop the WWWPS service (in Windows Services). The virtual host then becomes instantly available. It instantly stops working when the WWWPS is started again.
Upvotes: 0
Reputation: 231
I have similar issue, vhosts not working. But in my case I found there was the permission issue with host file. Hope this helps for some one. hosts file ignored, how to troubleshoot?
Upvotes: 0
Reputation: 633
One thing I'd like to add here: For anyone who is sure everything is setup correctly, make sure you don't use any underscores in the alias string within your hosts file; for some reason it can't accept underscores.
Upvotes: 0
Reputation: 359
The answer I found that works is to to this in the hosts file.
192.168.0.47 localhost somthing.instancegaming.net
Upvotes: 0