| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- user root;
- worker_processes auto;
- pid /run/nginx.pid;
- include /etc/nginx/modules-enabled/*.conf;
- events {
- worker_connections 768;
- # multi_accept on;
- }
- http {
- ##
- # Basic Settings
- ##
- sendfile on;
- tcp_nopush on;
- tcp_nodelay on;
- keepalive_timeout 65;
- types_hash_max_size 2048;
- # server_tokens off;
- # server_names_hash_bucket_size 64;
- # server_name_in_redirect off;
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- ##
- # SSL Settings
- ##
- ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
- ssl_prefer_server_ciphers on;
- ##
- # Logging Settings
- ##
- access_log /var/log/nginx/access.log;
- error_log /var/log/nginx/error.log;
- ##
- # Gzip Settings
- ##
- gzip on;
- # 大屏应用配置
- server {
- listen 9998;
- server_name 47.93.202.126;
-
- # location = /bigScreen {
- # return 302 $scheme://$http_host/bigScreen/;
- # }
-
- location /bigScreen/ {
- alias /home/website/zlzh/bigScreen/dist/;
- try_files $uri $uri/ /index.html;
-
- # 静态文件缓存
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- }
- }
- # API代理配置
- location /api {
- # 这里需要替换为你的实际API服务器地址
- proxy_pass http://127.0.0.1:8080; # 请修改为你的API服务器地址
- 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_set_header X-Forwarded-Proto $scheme;
-
- # 代理超时设置
- proxy_connect_timeout 60s;
- proxy_send_timeout 60s;
- proxy_read_timeout 60s;
-
- # WebSocket支持(如果需要)
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
-
- # Web应用配置(根目录)
- location / {
- root /home/website/zlzh/web/dist;
- try_files $uri $uri/ /index.html;
-
- # 静态文件缓存
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- }
- }
- }
- # Web应用和API配置
- server {
- listen 10000;
- server_name zhyh.hnyulin.com;
-
- # API代理配置
- location /api {
- # 这里需要替换为你的实际API服务器地址
- proxy_pass http://127.0.0.1:8080; # 请修改为你的API服务器地址
- 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_set_header X-Forwarded-Proto $scheme;
-
- # 代理超时设置
- proxy_connect_timeout 60s;
- proxy_send_timeout 60s;
- proxy_read_timeout 60s;
-
- # WebSocket支持(如果需要)
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
-
- # Web应用配置(根目录)
- location / {
- root /home/website/zlzh/web;
- try_files $uri $uri/ /index.html;
-
- # 静态文件缓存
- location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
- expires 1y;
- add_header Cache-Control "public, immutable";
- }
- }
-
- # 通用配置
- # access_log /var/log/nginx/zhyh_access.log main;
- # error_log /var/log/nginx/zhyh_error.log notice;
-
- # 客户端限制
- client_max_body_size 100M;
-
- # 禁止访问隐藏文件
- location ~ /\. {
- deny all;
- }
- }
- include /etc/nginx/conf.d/*.conf;
- include /etc/nginx/sites-enabled/*;
- }
|