【问题标题】:Disable security for sub path in Apache2在 Apache2 中禁用子路径的安全性
【发布时间】:2019-02-16 13:19:51
【问题描述】:

我在我的 apache 中定义了一个代理,有任何方法可以禁用子路径的安全性。 在配置中我有/app pointing 到端口localhost:8000,我希望/app/public 指向localhost:8000/public

这是我的配置文件(所有路径都具有安全性):

<VirtualHost *:80>
    ProxyPreserveHost On
    ProxyPass /app http://localhost:8000
    ProxyPassReverse /app http://localhost:8000

    ServerName example.com

    <Proxy *>
        Order deny,allow
        Allow from all
        Authtype Basic
        Authname "Password Required"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
</Proxy>

</VirtualHost>

【问题讨论】:

    标签: apache proxy apache2 reverse-proxy configuration-files


    【解决方案1】:

    我找到了解决方案,我使用 LocationMatch 代替 Proxy 标签,这是生成的 conf 文件:

    <VirtualHost *:80>
        ProxyPreserveHost On
        ProxyPass /app http://localhost:8000
        ProxyPassReverse /app http://localhost:8000
    
        ServerName example.com
    
        <LocationMatch "^(?!/path/to/exclude)/[^/]+">
            Order deny,allow
            Allow from all
            Authtype Basic
            Authname "Password Required"
            AuthUserFile /etc/apache2/.htpasswd
            Require valid-user
        </LocationMatch>
    
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-02
      • 1970-01-01
      • 2019-12-09
      • 2015-09-14
      • 1970-01-01
      • 1970-01-01
      • 2012-08-06
      • 1970-01-01
      相关资源
      最近更新 更多