user nobody; worker_processes 2; 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; client_max_body_size 30M; 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 logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; server { listen 98; location / { 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_pass http://127.0.0.1:9800; } location /mqtt { 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_pass http://127.0.0.1:1884; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } #静态文件根路径 server { listen 81; location / { root /home/web/; try_files $uri $uri/ /index.html; index index.html; } } server { listen 80; server_name test.com localnet.com www.test.com 192.168.1.88; #charset koi8-r; access_log logs/host.access.log main; error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location /statics/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1/labSystem/statics/; } location ^~/labSystem/admin/statics/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1/labSystem/statics/; } location /mettingroom/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:8080/mettingroom/; } location ^~/mettingroom/admin/ { proxy_redirect off; 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_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/mettingroom/; } #jenkins相关配置 location /jenkins/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:8082/jenkins/; } #git相关配置 location /gogs/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:3000/; } #wq相关配置 location /wq/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:8083/wq/; } location ^~/wq/admin/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/wq/; } #wq相关配置 location /xzgd/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:8091/xzgd/; } location ^~/xzgd/admin/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/xzgd/; } location /labSystem/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:9800/; } location ^~/labSystem/admin/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/labSystem/; } location ^~/labSystem/bigData/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/bigData/; } location ^~/labSystem/labBigData/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/labBigData/; } } server { listen 443 ssl; server_name lab.sxitdlc.com; #ssl on; ssl_certificate /usr/local/nginx/cert/server.crt; ssl_certificate_key /usr/local/nginx/cert/server.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; #add_header Access-Control-Allow-Origin *; #add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; #add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'; #if ($request_method = 'OPTIONS') { # return 204; #} location / { root /home/; #index index.html index.htm; } location /statics/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1/labSystem/statics/; } location ^~/labSystem/admin/statics/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1/labSystem/statics/; } location /labSystem/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:9800/; } location ^~/labSystem/admin/ { proxy_redirect off; 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 1000m; proxy_read_timeout 3600s;#超时设置 proxy_pass http://127.0.0.1:81/labSystem/; } location /mqtt { proxy_pass http://127.0.0.1:1884; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Sec-WebSocket-Protocol mqtt; } } }