centos7 nginx反向代理无法访问 502

买房动力十足 2019-05-21 04:06:47
centos7 nginx反向代理无法访问 502
配置如下,主要就是两个server_name 不同,*.x.com, a.x.com
代理分别不同的后端服务器,http://139.x.x.x:8090/admin(腾讯云服务器) 是可以访问的,

而 a.x.com/admin 访问,返回的始终是502,很奇怪,
而*.x.com/admin(阿里云服务器) 都是可以访问到的



server {
listen 443 ssl http2;
ssl on;
ssl_certificate /usr/local/nginx/ssl/*.x.com.key.pem;
ssl_certificate_key /usr/local/nginx/ssl/*.x.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name a.x.com;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/mall/dist;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}

#将请求转发到admin
location /admin {
root html;
proxy_pass http://139.x.x.x:8090/admin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100m;
index index.html index.htm;
}

}

server {
listen 443 ssl http2;
ssl on;
ssl_certificate /usr/local/nginx/ssl/*.x.com.key.pem;
ssl_certificate_key /usr/local/nginx/ssl/*.x.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_timeout 10m;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_buffer_size 1400;
add_header Strict-Transport-Security max-age=15768000;
ssl_stapling on;
ssl_stapling_verify on;
server_name *.x.com;
access_log /data/wwwlogs/access_nginx.log combined;
root /data/mall/dist;
index index.html index.htm index.php;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}

#将请求转发到admin
location /admin {
root html;
proxy_pass http://127.0.0.1:8090/admin;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 100m;
index index.html index.htm;
}

}

...全文
194 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
LubinLew 2019-05-21
  • 打赏
  • 举报
回复
*.x.com 包括 a.x.com

腾讯server 抓包 看一下 转发的请求到没到, 是不是被腾讯干掉了

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧