106 lines
2.6 KiB
Plaintext
106 lines
2.6 KiB
Plaintext
|
||
user nginx;
|
||
worker_processes auto;
|
||
error_log /var/opt/rh/rh-nginx116/log/nginx/error.log;
|
||
pid /var/opt/rh/rh-nginx116/run/nginx/nginx.pid;
|
||
|
||
events {
|
||
worker_connections 1024;
|
||
}
|
||
|
||
|
||
http {
|
||
include /etc/opt/rh/rh-nginx116/nginx/mime.types;
|
||
default_type application/octet-stream;
|
||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||
'$status $body_bytes_sent "$http_referer" '
|
||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||
|
||
access_log /var/opt/rh/rh-nginx116/log/nginx/access.log main;
|
||
|
||
|
||
sendfile on;
|
||
#tcp_nopush on;
|
||
|
||
keepalive_timeout 65;
|
||
|
||
#gzip on;
|
||
|
||
|
||
#设置Tomcat服务器所在IP和端口
|
||
upstream ems{
|
||
hash $remote_addr consistent;
|
||
|
||
server 127.0.0.1:2111;
|
||
}
|
||
|
||
server {
|
||
#监听前端请求的端口
|
||
listen 1120;
|
||
#服务器名称
|
||
server_name localhost;
|
||
#请求体的最大上限
|
||
client_max_body_size 5m;
|
||
|
||
# 设置语言 cn:中文;en:英文;
|
||
set $language "cn";
|
||
|
||
#access_log logs/host.access.log main;
|
||
location ^~ /report/{
|
||
proxy_pass http://ems/;
|
||
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_connect_timeout 300s;
|
||
proxy_read_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
}
|
||
|
||
location ^~ /ems/ {
|
||
proxy_pass http://ems/;
|
||
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_connect_timeout 60s;
|
||
proxy_read_timeout 60s;
|
||
proxy_send_timeout 60s;
|
||
}
|
||
|
||
location ^~ /ws/ {
|
||
proxy_pass http://ems/;
|
||
proxy_set_header Host $host:$server_port;
|
||
proxy_http_version 1.1;
|
||
proxy_connect_timeout 60s; #配置点1
|
||
proxy_read_timeout 600s; #配置点2,如果没效,可以考虑这个时间配置长一点
|
||
proxy_send_timeout 60s; #配置点3
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection "upgrade";
|
||
}
|
||
location =/login.html {
|
||
root @file_location@;
|
||
if ( $request_uri ~ "/login.html$" ){
|
||
# redirect 302临时重定向
|
||
# permanent 301永久重定向
|
||
rewrite ^(.*)$ $uri?lng=$language permanent;
|
||
break;
|
||
}
|
||
|
||
}
|
||
location / {
|
||
root @file_location@;
|
||
if ( $request_uri ~ "/$" ){
|
||
# redirect 302临时重定向
|
||
# permanent 301永久重定向
|
||
rewrite ^(.*)$ login.html?lng=$language permanent;
|
||
break;
|
||
}
|
||
}
|
||
# error_page 500 502 503 504 404 /test.html;
|
||
location = /test.html {
|
||
root @file_location@;
|
||
}
|
||
|
||
}
|
||
}
|