[英]nginx proxy_pass doesn't work to localhost
I have my node app running locally on port 3000, I've set up nginx but for some reason it doesn't work right. 我的节点应用程序在端口3000上本地运行,我已经设置了nginx,但是由于某种原因它无法正常工作。
I tried to proxy_pass to http://google.com and it worked, but when I change it to http://localhost:3000 I get the nginx error page. 我尝试将proxy_pass传递到http://google.com并成功,但是当我将其更改为http:// localhost:3000时,我得到了nginx错误页面。
the app is running, i opened port 3000 on my server and I can access it on my http://domain:3000 . 该应用程序正在运行,我在服务器上打开了端口3000,然后可以在http:// domain:3000上访问它。
server {
listen 80;
listen [::]:80;
server_name mydomain.com;
# root /usr/share/nginx/html;
location / {
proxy_pass "http://localhost:3000";
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
any idea why the proxying doesn't work properly? 知道为什么代理不能正常工作吗?
Thanks. 谢谢。
This was SELinux issue - blocked http requests. 这是SELinux问题-阻止了HTTP请求。
this command solved it: 这个命令解决了它:
setsebool -P httpd_can_network_connect true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.