探索,發現,愛好、學習,記錄,分享。
學海無涯,天涯若比鄰,三人行,必有我師。

Apache ProxyPass 出现503 Service Temporarily Unavailable 的解决方案

访问出现503错误:

Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Apache Server at localhost Port 80
 
 
查看apache日志/var/log/httpd/error_log:
[Wed Aug 10 21:02:27 2011] [error] (13)Permission denied: proxy: HTTP: attempt to connect to 10.140.0.109:7080 (127.0.0.1) failed
[Wed Aug 10 21:02:27 2011] [error] ap_proxy_connect_backend disabling worker for (10.140.0.109)
[Wed Aug 10 20:30:51 2011] [error] proxy: HTTP: disabled connection for (127.0.0.1)

 
日志/var/log/httpd/access_log:
127.0.0.1- – [10/Aug/2011:21:02:27 -0400] “GET /jsp/ HTTP/1.0” 503 401 “-” “Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; CIBA; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)”
 
经过查资料和分析怀疑是SELinux的原因,于是查看果然是:
[root@ logs]# /usr/sbin/getsebool -a |grep http_can_network_connect
httpd_can_network_connect –> off

 
于是尝试解决方案:
我们需要将httpd_can_network_connect设置为on:
[root@ logs]# /usr/sbin/getsebool -P httpd_can_network_connect=1
[root@ logs]# /usr/sbin/getsebool -a |grep http_can_network_connect
httpd_can_network_connect –> on
 
重新访问,页面果然可以访问了。
另外直接关掉SELinux也是可以解决这个问题的:
修改/etc/selinux/config 然后重启:
SELINUX=disabled
 
或者实时生效的方式:
[root@ var]# /usr/sbin/setenforce 0
 
附关于SELinux:
SELinux(Security-Enhanced Linux) 是美国国家安全局(NSA)对于强制访问控制的实现,是 Linux® 上最杰出的新安全子系统。NSA是在Linux社区的帮助下开发了一种访问控制体系,在这种访问控制体系的限制下,进程只能访问那些在他的任务中所需要文件。SELinux 默认安装在 Fedora 和 Red Hat Enterprise Linux 上,也可以作为其他发行版上容易安装的包得到。

关闭SELinux的方法:
修改/etc/selinux/config文件中的SELINUX=”” 为 disabled ,然后重启。
如果不想重启系统,使用命令setenforce 0
注:
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式 
在lilo或者grub的启动参数中增加:selinux=0,也可以关闭selinux 
getenforce/setenforce查看和设置SELinux的当前工作模式 

版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權
轉載事宜:如需轉載需徵得應允,轉載必須注明來源於本站的信息。
文章名称:《Apache ProxyPass 出现503 Service Temporarily Unavailable 的解决方案》
文章链接:https://www.thefreesky.com/blog/26064.html
本站資源僅供個人學習交流,請於下載後24小時內刪除,不允許用於商業用途,否則法律問題自行承擔。

評論 抢沙发