143 lines
4.2 KiB
Nginx Configuration File
143 lines
4.2 KiB
Nginx Configuration File
|
|
|
|||
|
|
worker_processes auto;
|
|||
|
|
|
|||
|
|
events {
|
|||
|
|
worker_connections 1024;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
http {
|
|||
|
|
include mime.types;
|
|||
|
|
default_type application/octet-stream;
|
|||
|
|
|
|||
|
|
client_max_body_size 100M;
|
|||
|
|
|
|||
|
|
sendfile on;
|
|||
|
|
|
|||
|
|
keepalive_timeout 65;
|
|||
|
|
|
|||
|
|
gzip on;
|
|||
|
|
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/bmp application/x-bmp image/x-ms-bmp application/vnd.ms-fontobject font/ttf font/opentype font/x-woff application/json;
|
|||
|
|
gzip_vary on;
|
|||
|
|
|
|||
|
|
#设置Tomcat服务器所在IP和端口
|
|||
|
|
upstream java_report{
|
|||
|
|
# hash $remote_addr consistent;
|
|||
|
|
server 127.0.0.1:2111;
|
|||
|
|
}
|
|||
|
|
upstream web_server_simple{
|
|||
|
|
# hash $remote_addr consistent;
|
|||
|
|
server 127.0.0.1:2112;
|
|||
|
|
}
|
|||
|
|
upstream web_server_async{
|
|||
|
|
# hash $remote_addr consistent;
|
|||
|
|
server 127.0.0.1:2113;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
upstream web_server_bi{
|
|||
|
|
#hash $remote_addr consistent;
|
|||
|
|
server 127.0.0.1:2114;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
server {
|
|||
|
|
include conf.d/root.conf;
|
|||
|
|
|
|||
|
|
#监听前端请求的端口
|
|||
|
|
listen 1120;
|
|||
|
|
#服务器名称
|
|||
|
|
server_name localhost;
|
|||
|
|
#请求体的最大上限
|
|||
|
|
client_max_body_size 60m;
|
|||
|
|
|
|||
|
|
# 设置语言 cn:中文;en:英文;
|
|||
|
|
set $language "cn";
|
|||
|
|
|
|||
|
|
|
|||
|
|
location /platform/ {
|
|||
|
|
#alias /opt/PowerSCADA3000L/web/nginx/html/platform/;
|
|||
|
|
try_files $uri $uri/ /index.html;
|
|||
|
|
#index ../index.html index.htm;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /api- {
|
|||
|
|
proxy_pass http://web_server_bi;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
location ^~ /webSocket {
|
|||
|
|
proxy_pass http://web_server_bi;
|
|||
|
|
proxy_set_header Host $host:$server_port;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
|
proxy_set_header Connection "upgrade";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /report/monitorBusiness/{
|
|||
|
|
proxy_pass http://web_server_simple/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /report/emsBusiness/{
|
|||
|
|
proxy_pass http://web_server_simple/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /report/{
|
|||
|
|
proxy_pass http://java_report/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /ems/monitorBusiness/{
|
|||
|
|
proxy_pass http://web_server_simple/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /ems/ {
|
|||
|
|
proxy_pass http://web_server_simple/;
|
|||
|
|
proxy_set_header Host $host;
|
|||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /ws/realTimeDataWebsocket {
|
|||
|
|
proxy_pass http://web_server_simple/realTimeDataWebsocket;
|
|||
|
|
proxy_set_header Host $host:$server_port;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
|
proxy_set_header Connection "upgrade";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location ^~ /ws/ {
|
|||
|
|
proxy_pass http://web_server_async/;
|
|||
|
|
proxy_set_header Host $host:$server_port;
|
|||
|
|
proxy_http_version 1.1;
|
|||
|
|
proxy_set_header Upgrade $http_upgrade;
|
|||
|
|
proxy_set_header Connection "upgrade";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location =/login.html {
|
|||
|
|
if ( $request_uri ~ "/login.html$" ){
|
|||
|
|
rewrite ^(.*)$ $uri?lng=$language permanent;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
location / {
|
|||
|
|
if ( $request_uri ~ "/$" ){
|
|||
|
|
rewrite ^(.*)$ login.html?lng=$language permanent;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|