Apache代理返回403禁止


3

我正在尝试设置一个主页,我可以使用代理将请求重定向到其他服务器,因此我只有一个入口点。我曾经在运行WAMP的Windows机器上正常工作。我在CentOS7上切换到了Apache,因为我遇到了这个问题。这是我的目标网页:

<VirtualHost *:443>
    ServerName myhost.duckdns.org
    DocumentRoot /var/www/html/panel

    SSLEngine on
    SSLCertificateKeyFile /etc/letsencrypt/live/myhost.duckdns.org/privkey.pem
    SSLCertificateFile /etc/letsencrypt/live/myhost.duckdns.org/cert.pem
    SSLCertificateChainFile /etc/letsencrypt/live/myhost.duckdns.org/chain.pem
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown


    <Directory /var/www/html/panel>
    Order deny,allow
    Deny from all
    Allow from myips
    AuthType Basic
    AuthName "Authorised Users Only"
    AuthUserFile .htpasswd
    Satisfy Any
    Require valid-user
    </Directory>

这是代理通道

<VirtualHost *:443>
ServerName sickbeard.my.to

    SSLEngine on
    SSLCertificateKeyFile /etc/letsencrypt/live/sickbeard.my.to/privkey.pem
    SSLCertificateFile /etc/letsencrypt/live/sickbeard.my.to/cert.pem
    SSLCertificateChainFile /etc/letsencrypt/live/sickbeard.my.to/chain.pem
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown

    <Proxy *>
    Order deny,allow
    Deny from all
    Allow from myips
    AuthType Basic
    AuthName "Authorised Users Only"
    AuthUserFile .htpasswd
    Satisfy Any
    Require valid-user
    </Proxy>
    ProxyPass / http://192.168.0.170:8081/
    ProxyPassReverse / http://192.168.0.170:8081/
</VirtualHost>

我可以毫无问题地到达主页面,我可以使用IP或主机名到达病态但使用主机名给我403。


允许来自myips - 所以我猜你有ip而不是主机名..
Setekh

@Setekh是的,那里有4个ips
Gab

你可以尝试从FQDN添加允许..
Setekh

@Setekh刚试过,同样的事情:/
Gab

嗯,你有任何重写阻止..像RewriteCond%{HTTP_REFERER} microsoft \ .com [NC,OR] RewriteRule。* - [F]:D它可能有一些错误
Setekh

Answers:


3

找到了!它被mod_security模块阻止了!我应该先检查一下日志。

我在httpd.conf中禁用了该模块。我读了一下这个主题,对于我正在做的事情,这个模块显然是一个过度的。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.