解决nginx访问问题connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,

2023-04-25,,

问题:搭建好项目之后,用nginx进行代理,进行日常配置之后,发现前端正常访问,但是后端访问出现错误,报502错误,查找nginx日志,发现connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,有这个错误。网上查阅得知是selinux没有关闭。

解决步骤:

  关闭selinux

[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config

网上还有一种说法,在此记录下。执行下面的命令

setsebool -P httpd_can_network_connect 

解决nginx访问问题connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,的相关教程结束。

《解决nginx访问问题connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream,.doc》

下载本文的Word格式文档,以方便收藏与打印。