| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- access_log off;
- add_header Access-Control-Allow-Origin *;
- add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
- add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Range,Content-Type,Authorization';
- add_header 'Access-Control-Expose-Headers' 'X-Location';
- sendfile on;
- keepalive_timeout 65;
- gzip on;
- gzip_min_length 20;
- gzip_comp_level 5;
- gzip_vary on;
- gzip_types application/javascript application/x-javascript text/javascript image/png image/x-icon;
- gzip_static on;
- gzip_buffers 2 4k;
- gzip_http_version 1.1;
- server {
- listen 80;
- server_name localhost;
- location / {
- root /oem/usr/zhiyun/web/dist;
- try_files $uri $uri/ /index.html;
- }
-
- location /api {
- proxy_pass http://127.0.0.1:5000; # 转发到本地 5000 端口(Tauri 后端)
- rewrite ^/api/(.*)$ /$1 break; # 去掉 /api 前缀(因为后端接口是 /getConfig,不是 /api/getConfig)
- }
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
- }
- }
- }
|