Wamp Apache - Allow localhost

不羁岁月 提交于 2019-12-05 08:56:29

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 )

Update your httpd.conf to this, and you will be able to get to localhost on WAMP.

<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 ::1
</Directory>

If you are using Apache 2.4 then use:

<Directory "C:/wamp/www/">
    Require all denied
    Require ip 127.0.0.1 
    <If "%{HTTP_HOST} == 'localhost'">
    Require all granted
    </If>
</Directory>
alvaroreig

1) I don't know if your Directory sintax is correct as I use ubuntu server, but I always put the lines that allow individual addresses before the "Deny from all" directive. However, in the apache documentation you can see examples where the directives are in the same order as in your code

Link

I alse specify the netmask, which in the case of individual IPs should be 255.255.255.255, more fine-grained subnet restriction.

I have always seen the words deny,allow in the first directive in lowercase, but as you are using Windows maybe it is not necessary. The code that I would use is:

order deny,allow
Allow from 127.0.0.1/255.255.255.255
Allow from 192.168.x.x/255.255.255.255
Allow from localhost/255.255.255.255
Deny from all

2) Yes, as you are denying every petition except those that come from the specified IPs

Related reference

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