#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;
worker_rlimit_nofile 65535;
events {
worker_connections 20480;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 30m;
upstream tomcats{
server 127.0.0.1:8080;
#server 127.0.0.1:8081;
#server 127.0.0.1:8082;
}
upstream websocket {
server 127.0.0.1:8080;
}
server {
listen 80;
listen 443 ssl;
server_name *.baidu.com baidu.com;
ssl_certificate /project/Nginx/httpsKey/*****.pem;
ssl_certificate_key /project/Nginx/httpsKey/*****.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
#静态资源文件连接处理
location ^~ /files{
add_header Access-Control-Allow-Origin *;
alias C:\project\systemFiles;
autoindex off;
}
#常规请求处理
location / {
proxy_pass http://tomcats;
proxy_set_header Cookie $http_cookie;
proxy_redirect default;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
#websocket连接处理
location ^~ /messageWebSocket{
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_read_timeout 7200;#必须设置很长时间,否则断掉,nginx默认才60秒
}
}
}