微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

NGNIX 返回 502

如何解决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 端口监听良好(实例健康)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。