Apache反向代理返回503 Service Unavailable
–httpd.conf
<VirtualHost *:80>
ServerName ip
ProxyRequests Off
<Proxy *>
Require all granted
ProxyPass /service http://ip:port/service
ProxyPassReverse /service http://ip:port/service
–Postman返回
503 Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
–/etc/httpd/logs/error_log
Permission denied: AH00957: HTTP: attempt to connect to **********(*****) failed
AH01114: HTTP: failed to make connection to backend: 192.168.199.115
– 猜测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
或者修改/etc/selinux/config文件中的SELINUX="disabled“ ,然后重启。
重新发送请求试一下~
本文介绍了一个关于Apache作为反向代理时出现503ServiceTemporarilyUnavailable错误的问题排查过程。通过检查配置文件httpd.conf及日志文件error_log发现连接被拒绝的原因,并最终确认SELinux设置不当导致的问题。通过对SELinux策略进行调整,成功解决了Apache无法正常代理后端服务的问题。
2773

被折叠的 条评论
为什么被折叠?



