【问题标题】:How to restrict url access with apache to certain IP?如何将 apache 的 url 访问限制为特定 IP?
【发布时间】:2017-09-08 11:14:03
【问题描述】:

我在 ubuntu 上使用 apache2,在 tomcat8 网络服务器前面。 我想限制对localhost/manager 的访问仅限于特定的IP 地址。

服务器在我的内部网络中,IP 为102.168.139.111。我希望能够仅从我的本地计算机 192.168.128.222 访问 /manager 端点,而不能从其他任何地方访问。

但以下方法不起作用,我总是收到403 Permission denied。为什么?

apache2.conf:

<Location /manager/*>
        Order Allow,Deny
        Deny from  all
        Allow from 192.168.128.197
</Location>

与:

/etc/apache2/sites-available/000-default.conf

<VirtualHost *:80>
    ProxyPreserveHost On

    ProxyPass / http://127.0.0.1:8080/
    ProxyPassReverse / http://127.0.0.1:8080/
</VirtualHost>

旁注:取出&lt;Location...&gt; 将允许按预期访问我的本地IP。所以一般的服务器配置似乎没问题。仅仅限制是行不通的。

【问题讨论】:

    标签: apache ubuntu apache2


    【解决方案1】:

    这可能是语句顺序问题。以下工作(在根路径上):

    <Location />
            Order Deny,Allow
            Deny from all
            Allow from 192.168.
    </Location>
    

    【讨论】:

      猜你喜欢
      • 2011-06-18
      • 1970-01-01
      • 1970-01-01
      • 2013-11-11
      • 1970-01-01
      • 2022-01-17
      • 1970-01-01
      • 1970-01-01
      • 2017-08-16
      相关资源
      最近更新 更多