worker_processes auto;
events {
worker_connections 102400;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$http_x_forwarded_for $remote_addr - [$time_local] $request $status $body_bytes_sent $request_time $http_referer $http_user_agent $upstream_addr $upstream_status $upstream_response_time';
sendfile on;
keepalive_timeout 65;
gzip on;
/**
*
*以下为重定向的目标地址与端口号
*
*/
upstream 80_api {
server 10.0.0.0:19400;
}
upstream 6080_api {
server 10.0.0.0:6080;
keepalive 2000;
}
upstream 4200_api {
server 10.0.0.0:4200;
keepalive 2000;
}
upstream futaiping {
server 10.0.0.0:9090;
}
server {
/***
*以下为nginx起的端口服务,也是访问项目的地址端口号
**/
listen 8099;
server_name localhost;
/**
* 默认重定向地址
*/
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 500m;
proxy_pass http://futaiping;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
}
/**
* 请求带/websockify后缀重定向地址
*/
location /websockify {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 500m;
proxy_pass http://6080_api;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
/**
* 请求带/hostconsole重定向配置
*/
location /hostconsole {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 500m;
proxy_pass http://4200_api;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
}
/**
* 请求带/api重定向配置
*/
location /api {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 500m;
proxy_pass http://80_api;
proxy_connect_timeout 3600s;
proxy_send_timeout 3600s;
proxy_read_timeout 3600s;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}