回答
收藏
分享
举报
前后端分离要用2个nginx代理,之前运行正常
提问于2021-07-12 09:47

浏览 993

7月4日前一直运行正常,从7月5日开始,chrome浏览器访问url页面出现后端接口无应答的问题,定位排查过程如下:

1、浏览器版本,试过多个chrome版本,问题依然存在。

2、请求过多导致后台接口拥塞,通过查看数据库连接池和降低用户数,问题依然存在。

3、查看nginx日志、后台接口日志,发现nginx有请求日志,但后台接口日志没有,故定位在nginx上。

4、重装nginx,问题依然存在。

5、最后找到的解决方法描述:再搭建一个新的nginx,将前后端分别用不同nginx代理,问题解决了,但没找到原因,且感觉治标不治本,请各位大神帮忙给看看问题所在。以下是nginx的配置文件

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}



http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 600;
#tcp_nopush on;
fastcgi_connect_timeout 600s;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
fastcgi_buffer_size 256k;
fastcgi_buffers 16 256k;
fastcgi_busy_buffers_size 512k;
fastcgi_temp_file_write_size 512k;


### 头最大长度,解决燃气数据上传问题
client_header_buffer_size 16k;
large_client_header_buffers 4 16k;

server {
listen 8080;
server_name 2.20.8.42;

# 文件上传大小
client_max_body_size 1024m;
# 请求体缓存区大小
client_body_buffer_size 40m;

# 前端内网
location /wgNewNW/{
proxy_pass http://2.20.8.33:8680;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_send_timeout 600;
proxy_read_timeout 600;
}

# 前端互联网UI
location /wgNew/{
proxy_pass http://2.20.8.33:8680;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_send_timeout 600;
proxy_read_timeout 600;
proxy_buffering off;
}

# 后台cas
location /cas/{
proxy_pass http://2.20.8.36:8999/cas/;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_set_header Connection "";
}

# 后台门户
location /portal/{
proxy_pass http://2.20.8.36:8999/portal/;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
#proxy_set_header Connection "";
}

# 后代主服务1
location /OrientTDM/{
proxy_pass http://2.20.8.27:9880;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection "";
proxy_buffering off;
proxy_send_timeout 600;
proxy_read_timeout 600;
}


# 后台服务2
location /wghserver/{
proxy_pass http://2.20.8.27:8188;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection "";
proxy_buffering off;
}

# 后台服务3
location /AptxDB/{
proxy_pass http://2.20.8.27:9680;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection "";
proxy_buffering off;
proxy_send_timeout 600;
proxy_read_timeout 600;
}

# 后台服务3
location /arcgis/{
proxy_pass http://2.20.8.35:6080;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_send_timeout 90;
proxy_read_timeout 90;
}

# 后台服务4
location /xfgl/ {
proxy_pass http://2.20.8.33:7980;
}

# 后台服务5
location /FileServiceWeb/ {
proxy_pass http://2.20.8.34:8780;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
}

# 前端大屏
location /dist/{
proxy_pass http://2.20.8.33:8680;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
}

# 后台服务6
location /sgtserver/{
proxy_pass http://2.20.8.27:8288;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
}

# 检察院前端
location /XW-JCY/{
proxy_pass http://2.20.8.24:18080;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering off;
proxy_send_timeout 90;
proxy_read_timeout 90;
}

# 检察院后台
location /JCY/{
proxy_pass http://2.20.8.24:16000;
###proxy_redirect off;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection "";
proxy_buffering off;
proxy_send_timeout 90;
proxy_read_timeout 90;

}



# 后台服务7
location /tyjr/{
proxy_pass http://2.20.8.115:8014/WebService.asmx;
}

# 后台服务8
location /os-api/{
proxy_pass http://2.20.8.36:8881/;
proxy_redirect default;
}

#
location /WebReport/{
proxy_pass http://2.20.8.35:8080;
}


# 网格化雪亮接口
location /artemis/{
proxy_pass http://2.16.66.38/;
}

}
}

#include /usr/local/nginx/conf/tcp.conf;

已修改于2023-03-17 02:13



写下您的回答
发表回答
全部回答(0)

按点赞数排序

按时间排序

提问者
星星_102
这家伙很懒还未留下介绍~
0
文章
1
问答
0
粉丝