我正在尝试将NGINX设置为我的NodeJS应用程序的前端,该应用程序在127.0.0.1:3000上运行,但我无法解决此502错误. NGINX可在本地访问,网址为http://55.55.55.5/或http://dev.example
dev.example(文件位于:/ etc / nginx / sites-available和符号链接到启用了网站)
upstream up_dev.example {
server 127.0.0.1:3000;
}
server {
listen 0.0.0.0:80;
server_name dev.example example;
access_log /var/log/nginx/dev.example.log;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://up_dev.example/;
proxy_redirect off;
}
}
error.log中
2014/09/17 19:38:26 [error] 1679#0: *1 connect() failed (111: Connection refused) while connecting to upstream,client: 55.55.55.1,server:,request: “GET / HTTP/1.1”,upstream:$
最佳答案
它也可能是SELinux,因为httpd_can_network_connect默认关闭,所以阻止了连接.
getsebool httpd_can_network_connect
检查是否已打开.如果没有,请通过运行将其打开
setsebool -P httpd_can_network_connect on
-P表示持久性更改,因此即使重新启动后,新布尔值仍然有效.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。