Can't access localhost with wamp and Chrome

依然范特西╮ 提交于 2019-12-07 11:02:48

问题


from today, when I go to localhost (http://localhost) after launch WAMP, in Firefox, as usual, everything is normal, but Chrome says "Forbidden, You don't have permission to access / on this server."

Anyone can help me please ?


回答1:


Edit: Solved it for me.

This is an IPv6 problem. Google must have just updated Chrome.

First of all ensure that your hosts file has the following line and that it is uncommented.

::1 localhost

Next, open up your Apache config (httpd.conf) and add the following to the listen section:

Listen [::1]:80

Next, you need to edit you Directory statements in httpd.conf or your vhosts files. They probably look something like this.

<Directory "C:\path">
    Options Indexes FollowSymLinks
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    AllowOverride All
</Directory>

Add an extra line after the 'Allow from 127.0.0.1' so it looks like this

<Directory "C:\path">
    Options Indexes FollowSymLinks
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    Allow from ::1
    AllowOverride All
</Directory>



回答2:


For anyone running into this problem this is what worked for me on apache 2.4.17

  • host file is here: C:\Windows\System32\drivers\etc

  • httpd.conf is here: C:\wamp64\bin\apache\apache2.4.17\conf

  • httpd-vhosts.conf is here: C:\wamp64\bin\apache\apache2.4.17\conf\extra

I made sure that localhost was enabled in my hosts file:

127.0.0.1       localhost
::1             localhost

just remove the # at the beginning of the line.

make sure this line in un-commented in your httpd.conf

Include conf/extra/httpd-vhosts.conf

In my file it was line 518.

then add this to your httpd-vhosts.conf file:

<VirtualHost *:80>
    ServerAdmin somerandomdude@whaaat.com
    DocumentRoot "c:/wamp64/www"
    ServerName localhost
</VirtualHost>

Then restart WAMP.

I don't know if that's the cleanest way of doing it(probs not). but it worked pretty well for me.




回答3:


It happens the same to me. From today I can not access with http://localhost to my wamp files with chrome.

In Firefox or Explorer I have no problems.

You can use 127.0.0.1 while the problem is solved.




回答4:


I had the same problem. This is how I solved it out:

  • I first added ::1 to host file,usually found at C:\Windows\System32\drivers\etc
  • Then I went ahead an opened my Chrome browser. I went to settings>advanced settings>Open proxy settings (under the title system)
  • In the new window that pops up go to 'LAN settings' then make sure you check 'Automatically detect settings'


来源:https://stackoverflow.com/questions/32453984/cant-access-localhost-with-wamp-and-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!