apache - Centos 6 上的 Apache 反向代理

标签 apache virtualhost reverse-proxy centos6

我正在尝试使用 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/

相关文章:

http - 处理虚拟主机 http 和 https 的区别

apache - 反向代理重定向 http 到 https

Apache 代理 cookie 仅适用于第一个应用程序

linux - 如何在没有证书(Apache VirtualHosts)的情况下将 HTTPS 请求重定向到 HTTP 并避免证书警告

php - 如何在 Apache 中为 ImageMagick 设置路径,以便可以从 PHP system() 运行?

Apache 未在 linux mint 中启动

docker - gitlab和taiga的反向代理-Docker

java - 无法以编程方式登录网站

mamp - 使用 Codekit 覆盖文件时权限被拒绝

apache - 虚拟主机重定向不存在的子域并删除 www