要仅允许本地主机在Apache的000默认 [英] To allow only localhost in Apache's 000-default

查看:173
本文介绍了要仅允许本地主机在Apache的000默认的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你怎么能只允许在本地主机的Apache2?

/ 000默认我的/ etc / apache2的/启用的站点,是

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

DocumentRoot /home/masi/Dropbox/a
<Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /home/masi/Dropbox/a/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                deny from all                             // Problem HERE!
        allow from 127.0.0.1
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

我浏览到 HTTP://localhost/index.php 失败。我得到禁止

推荐答案

开关使用您的允许,拒绝顺序(您想拒绝所有的第一次,然后允许本地主机)。

Switch your allow, deny order around (you want to deny all first, then allow localhost).

修改

Order allow,deny

要:

Order deny,allow

(这是默认行为)

(which is the default behavior)

这篇关于要仅允许本地主机在Apache的000默认的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆