-- apache 配置
<VirtualHost *:80>
ServerName www.mydomain.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://192.168.168.132:8089/
ProxyPassReverse / http://192.168.168.132:8089/
</VirtualHost>
-- 访问 http://www.mydomain.com/ 出现错误信息
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
-- 查看错误日志
# tail /var/log/httpd/error_log
[Fri Mar 08 16:38:14 2013] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 192.168.168.132:8089 (192.168.168.132) failed
[Fri Mar 08 16:38:14 2013] [error] ap_proxy_connect_backend disabling worker for (192.168.168.132)
-- 猜测SELinux影响
# /usr/sbin/getsebool -a | grep httpd_can_network_connect
httpd_can_network_connect --> off
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
-- 把httpd_can_network_connect设置为on
# /usr/sbin/setsebool -P httpd_can_network_connect=1
# /usr/sbin/getsebool -a | grep httpd_can_network_connect
httpd_can_network_connect --> on
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
再次访问 http://www.mydomain.com/ ,一切OK。
当然关闭 SELinux 也行
1)修改 /etc/selinux/config 然后重启
SELINUX=disabled
2)# /usr/sbin/setenforce 0 实时生效