Wamp Apache - Allow localhost

Fred K picture Fred K · May 22, 2013 · Viewed 26.3k times · Source

There are other questions similar to this but don't answer my problem.

This is the default httpd.conf:

<Directory "C:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

and it allows only 127.0.0.1, but I want to allow also localhost and 192.168.x.x (my private ip).

Well, the other answers are: put Allow from all and uncomment in hosts file the line 127.0.0.1 localhost; but I read that is unsecure or not reccomended.

So I've tried this:

<Directory "C:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
#   onlineoffline tag - don't remove
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
    Allow from 192.168.x.x
    Allow from localhost
</Directory>

It works for 192.168.x.x, but not for localhost (gets error: 403 Forbidden, You don't have permission to access / on this server.)

1) How can make it works?

2) Maybe is required to uncomment in hosts file the line 127.0.0.1 localhost ?

3) Is it really more secure than Allow from all?

Answer

RiggsFolly picture RiggsFolly · May 30, 2013

Lets keep it simple, try this

<Directory "C:/wamp/www/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1 ::1 localhost 192.168 
</Directory>

::1 is the IPV6 equivalent of 127.0.0.1

I would use the first 3 of the quartiles 192.168.0 ( assuming your third quartile is 0 )