- server.py: zero-dependency stdlib backend (HTTP + WebSocket /ws), 大话骰 rule engine, server-driven bots - live.html: real MVP frontend wired to the backend over WebSocket - index.html/app.js/style.css: older static prototype - deploy/: systemd unit + Nginx reverse proxy + Let's Encrypt setup.sh - test_*.py: standalone HTTP / in-process test scripts Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
1.0 KiB
Plaintext
36 lines
1.0 KiB
Plaintext
# Nginx 反向代理 — dn.akqp.online → 127.0.0.1:8765 (server.py)
|
||
# 支持 WebSocket(/ws)。HTTPS 由 certbot --nginx 自动追加 443 段与跳转。
|
||
|
||
map $http_upgrade $connection_upgrade {
|
||
default upgrade;
|
||
'' close;
|
||
}
|
||
|
||
server {
|
||
listen 80;
|
||
listen [::]:80;
|
||
server_name dn.akqp.online;
|
||
|
||
# 入口直接打开真实 MVP 页面
|
||
location = / {
|
||
return 302 /live.html;
|
||
}
|
||
|
||
location / {
|
||
proxy_pass http://127.0.0.1:8765;
|
||
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;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
||
# WebSocket 升级(/ws 走这里)
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection $connection_upgrade;
|
||
|
||
# 长连接保活,避免 WS 被默认 60s 读超时切断
|
||
proxy_read_timeout 3600s;
|
||
proxy_send_timeout 3600s;
|
||
}
|
||
}
|