2026-04-18 11:11:38 +08:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name localhost;
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html;
|
|
|
|
|
|
|
|
|
|
# 开启 gzip 压缩
|
|
|
|
|
gzip on;
|
|
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
|
|
|
add_header Pragma "no-cache";
|
|
|
|
|
add_header Expires "0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# SSE realtime 连接(必须在 /api/ 之前)
|
|
|
|
|
location /api/realtime {
|
|
|
|
|
proxy_pass http://192.168.1.14:8712;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Connection '';
|
|
|
|
|
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_buffering off;
|
|
|
|
|
proxy_cache off;
|
|
|
|
|
proxy_read_timeout 86400s;
|
|
|
|
|
gzip off;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-19 22:24:28 +08:00
|
|
|
# Voice token service proxy
|
|
|
|
|
location /voice-api/ {
|
2026-04-21 16:12:18 +08:00
|
|
|
proxy_pass http://192.168.1.14:7893/api/;
|
2026-04-19 22:24:28 +08:00
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-21 14:38:48 +08:00
|
|
|
# Electron 自动更新文件托管
|
|
|
|
|
# 部署时将 electron/dist/latest.yml 和 electron/dist/*.exe 放到此目录
|
|
|
|
|
location /electron-update/ {
|
|
|
|
|
alias /usr/share/nginx/html/electron-update/;
|
|
|
|
|
autoindex on;
|
|
|
|
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-18 11:11:38 +08:00
|
|
|
# API 代理到局域网 PocketBase
|
|
|
|
|
location /api/ {
|
|
|
|
|
proxy_pass http://192.168.1.14:8712;
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
|
proxy_set_header Connection 'upgrade';
|
|
|
|
|
proxy_set_header Host $host;
|
|
|
|
|
proxy_cache_bypass $http_upgrade;
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 静态资源缓存
|
|
|
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
|
|
|
expires 1y;
|
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
|
|
|
}
|
|
|
|
|
}
|