Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access localhost with wamp and Chrome

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 ?

like image 572
DarkCid Avatar asked Sep 08 '15 09:09

DarkCid


2 Answers

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>
like image 128
SystemicPlural Avatar answered Sep 27 '22 23:09

SystemicPlural


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 [email protected]
    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.

like image 34
GeneralCan Avatar answered Sep 27 '22 22:09

GeneralCan