server { listen 443 ssl; server_name yund.c863.com; ssl_certificate /fushow/NginxVhostsConf/yund.c863.com_bundle.crt; ssl_certificate_key /fushow/NginxVhostsConf/yund.c863.com.key; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; # 最高优先级:专门匹配UniApp Vite打包的assets静态资源目录 location /assets/ { root /fushow/dist; expires 7d; add_header Cache-Control "public, immutable"; } # 根目录直接跳转到UniApp移动端首页 location = / { return 302 /pages/mobile/index; } # 前端history路由兜底 location / { root /fushow/dist; index index.html; try_files $uri $uri/ /index.html; } # 后端接口反向代理 location /api/ { proxy_pass http://127.0.0.1:8686/; 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_read_timeout 60s; } error_log /var/log/nginx/yund_ssl_error.log; access_log /var/log/nginx/yund_ssl_access.log; } # HTTP强制跳转HTTPS server { listen 80; server_name yund.c863.com; return 301 https://$host$request_uri; }