server { listen 80; server_name localhost; proxy_send_timeout 600s; # 设置发送超时时间, proxy_read_timeout 600s; # 设置读取超时时间。 # 前端打包好的dist目录文件 root /data/; location / { try_files $uri $uri/ /index.html; } # 若新增后端路由前缀注意在此处添加(|新增) location ^~ /api/ { proxy_pass http://wiregiard-srv:6687/; 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 REMOTE-HOST $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-Proto $scheme; } }