问题
I had an older version on XAMPP and it was working fine. I uninstalled it to install the new version.Since then local host has stopped working. XAMPP control panel says Apache and MySQL running.Can some one help please? I have got this in the httpd-vhosts.conf,do i make any changes here?
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host.localhost
##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
##ServerName dummy-host.localhost
##ServerAlias www.dummy-host.localhost
##ErrorLog "logs/dummy-host.localhost-error.log"
##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>
##<VirtualHost *:80>
##ServerAdmin postmaster@dummy-host2.localhost
##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
##ServerName dummy-host2.localhost
##ServerAlias www.dummy-host2.localhost
##ErrorLog "logs/dummy-host2.localhost-error.log"
##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>
Thank You
回答1:
you can also fix it by editing your host file usually located in %systemroot%\system32\drivers\etc\hosts
first of all backup your hosts file
comment this line by adding # at the beginning of the line(if its already their)
#::1 localhost
add this line in the end of the file
127.0.0.1 localhost
save it and restart your pc
if you face any problem just restore your hosts file
回答2:
As you can access it using 127.0.0.1
and not 'localhost', locate httpd-vhosts.conf
, usually in C:/xampp/apache/conf/extra/
and make sure you have the following listed as a virtual host:
<VirtualHost *>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
</VirtualHost>
Then restart Apache from the XAMPP control panel.
来源:https://stackoverflow.com/questions/5371858/xampp-v1-7-4-installation-issues-local-host-not-working