首页 > 解决方案 > NGNIX 返回 502

问题描述

我在 RHEL 8.2 服务器上运行的自定义脚本来配置 Nginx 反向代理服务器:

#!/bin/sh
sudo yum install nginx -y
sudo systemctl enable --now nginx
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --add-service=http --permanent
sudo systemctl restart firewalld
sudo cat > /etc/nginx/nginx.conf <<EOF
worker_processes  1; 

events {
    worker_connections  1024;
}

http {  
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80 default_server;
        server_name  _;
        
        location / {
            proxy_pass http://y:80;
        }
        #location /api {
        #   proxy_pass http://x/api;
        #} # end location
    } # end server
} # end http
EOF

sudo systemctl restart nginx

有人看到配置错误吗?脚本本身在 Azure VMSS 实例上运行,并且端口 80 侦听良好(实例正常)

标签: nginx-reverse-proxyazure-vm-scale-set

解决方案


推荐阅读