我正在尝试使用 Apache 将 URL 转发到另一台服务器。我在 httpd.conf 中创建了一个虚拟主机。当我尝试访问 ipServeur/test 时它不起作用。我无法访问该页面。
怎么了?
NameVirtualHost *:80
<VirtualHost *:80>
ServerName ipServeur
ProxyRequests off
ProxyPass /test http://ipOtherServeur:8080
ProxyPassReverse /test http://ipOtherServeur:8080
</VirtualHost>
最佳答案
来自 apache's wiki :
This error is not really about file permissions or anything like that. What it actually means is that httpd has been denied permission to connect to that IP address and port.
The most common cause of this is SELinux not permitting httpd to make network connections.
To resolve it, you need to change an SELinux boolean value (which will automatically persist across reboots). You may also want to restart httpd to reset the proxy worker, although this isn't strictly required.
要允许 apache 建立网络连接,请发出以下命令。
sudo /usr/sbin/setsebool httpd_can_network_connect 1
然后重启apache。
sudo service httpd restart
关于apache - Centos 6 上的 Apache 反向代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25055008/