centos7 nginx 配置 https反向代理 502 bad gateway
今天配置nginx https 反向代理 居然出现502 bad gateway, 原来是selinux的问题,汗~~nginx配置文件upstream test{server 127.0.0.1:8082;}server{listen 443 ssl;ssl_certificate www.example.com.crt;ssl_certificate_key www.example.com.k
·
今天配置nginx https 反向代理 居然出现502 bad gateway, 原来是selinux的问题,汗~~
nginx配置文件
upstream test{
server 127.0.0.1:8082;
}
server{
listen 443 ssl;
ssl_certificate www.example.com.crt;
ssl_certificate_key www.example.com.key;
server_name www.example.com;
server_tokens off;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://test/;
}
}
启动nginx,放地址居然是502 bad gateway
查看了nginx错误日志,居然是Permission denied
2020/07/16 14:37:54 [crit] 27257#27257: *33 connect() to 127.0.0.1:8082 failed (13: Permission denied) while connecting to upstream, client: 192.168.101.106, server: www.example.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8082/", host: "www.example.com"
网上查了原来是SELinux的原因
把它关掉算了
参考:Centos 7如何临时和永久关闭selinux
更多推荐
已为社区贡献1条内容
所有评论(0)