nginx-reverse-proxy - 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 侦听良好(实例正常)
解决方案
推荐阅读
- c - 尝试按文件和文件夹分隔 struct stat 时,为什么我有两个相同的数组?
- shell - 循环使用逗号分隔的子字符串,而不会中断空格
- angular - Angular 9:如何获取从 rest api 服务调用返回的对象的属性
- python - 可调用以添加到引用 M2M 关系的中间模型中的额外字段的 list_display
- python - django-channels 1.x 检测用户何时离开/刷新页面
- java - MANIFEST.MF 在 Web 项目中的外观如何?
- python - 是否可以通过 python sys 模块运行 MAFFT
- html - HTML 中只读输入字段的用途是什么?
- html - 我无法弄清楚我的 HTML 和 jQuery 实现有什么问题
- java - 以字符串形式返回数据