如何解决Nginx的"proxy_pass 502 Bad Gateway"问题?错误 [英] How to resolve Nginx "proxy_pass 502 Bad Gateway" error
本文介绍了如何解决Nginx的"proxy_pass 502 Bad Gateway"问题?错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在我的nginx.conf文件中添加proxy_set_header.当我尝试添加proxy_pass并调用URL时,它将引发502 Bad Gateway nginx/1.11.1错误.
I have trying to add proxy_set_header in my nginx.conf file. When I try to add proxy_pass and invoke the URL it throws 502 Bad Gateway nginx/1.11.1 error.
不确定如何解决此错误:
Not sure how to resolve this error:
upstream app-server {
# connect to this socket
server unix:///tmp/alpasso-wsgi.sock; # for a file socket
}
server {
server_name <name>;
listen 80 default_server;
# Redirect http to https
rewrite ^(.*) https://$host$1 permanent;
}
server {
server_name <name>;
listen 443 ssl default_server;
recursive_error_pages on;
location /azure{
proxy_pass http://app-server;
}
ssl on;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
ssl_client_certificate /etc/nginx/server.crt;
ssl_verify_client optional;
}
推荐答案
proxy_pass也有类似的问题,如果您的Linux服务器使用SELINUX,那么您可能想尝试一下.
Had similar problem with proxy_pass, if your Linux server is using SELINUX then you may want to try this.
$ setsebool -P httpd_can_network_connect true
请参阅沃伦的答案: https://unix.stackexchange. com/questions/196907/proxy-nginx-shows-a-bad-gateway-error
这篇关于如何解决Nginx的"proxy_pass 502 Bad Gateway"问题?错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文