在CentOS上配置Apache和Tomcat整合,因为之前windows已经配置好,所以httpd.conf就直接复制代码上去了。发现一直报错。
httpd_can_network_connect --> off
httpd_can_network_connect_cobbler --> off
httpd_can_network_connect_db --> off
#[/code]更改SELinux设置[code="shell"]# /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
#
[/code]另外关掉SELinux也是可以解决这个问题
修改/etc/selinux/config 然后重启:[quote]SELINUX=disabled[/quote]
或者实时生效的方式:[quote]# /usr/sbin/setenforce 0[/quote]
<VirtualHost *:80>
#域名
ServerName amap.jww.cn
#DocumentRoot /var/www/catlog
ErrorLog "/var/www/catlog/error.log"
CustomLog "/var/www/catlog/common.log" common
#反向代理Begin
ProxyPass /images !
ProxyPass /css !
ProxyPass /js !
#可多对
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
#反向代理END
</VirtualHost>
查看日志发现报错
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache/2.2.15 (CentOS) Server at amap.jww.cn Port 80
[Thu Jul 19 05:20:50 2012] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 127.0.0.1:8080 (127.0.0.1) failed
[Thu Jul 19 05:20:50 2012] [error] ap_proxy_connect_backend disabling worker for (127.0.0.1)
问渡娘后得知是是SELinux的原因,httpd不能防问网络[code="shell"]# /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
#[/code]更改SELinux设置[code="shell"]# /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
#
[/code]另外关掉SELinux也是可以解决这个问题
修改/etc/selinux/config 然后重启:[quote]SELINUX=disabled[/quote]
或者实时生效的方式:[quote]# /usr/sbin/setenforce 0[/quote]