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;
}
}
uj5u.com熱心網友回復:
*.x.com 包括 a.x.com騰訊server 抓包 看一下 轉發的請求到沒到, 是不是被騰訊干掉了
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/127234.html
標籤:系統維護與使用區
