server { listen 80; server_name kdy.1024tool.vip; # Nginx 状态监控端点 (HTTP) location /nginx_status { stub_status on; access_log off; allow 172.0.0.0/8; allow 192.168.0.0/16; # Docker bridge network allow 127.0.0.1; deny all; } location / { return 301 https://$host$request_uri; } } # HTTPS Server server { listen 443 ssl; server_name kdy.1024tool.vip; # SSL Config ssl_certificate /etc/nginx/ssl/kdy.1024tool.vip.pem; ssl_certificate_key /etc/nginx/ssl/kdy.1024tool.vip.key; ssl_session_timeout 5m; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_prefer_server_ciphers on; # 1. Douyin Game (Root Path) location / { root /usr/share/nginx/html/game; index index.html index.htm; try_files $uri $uri/ /index.html; # SPA Support } # 2. Minesweeper Game (Phaser3) location /minesweeper/ { alias /usr/share/nginx/html/minesweeper/; index index.html index.htm; try_files $uri $uri/ /minesweeper/index.html; } # 3. Admin Frontend (Subpath /admin) location /admin/ { alias /usr/share/nginx/html/admin/; index index.html index.htm; try_files $uri $uri/ /admin/index.html; # SPA Support for /admin prefix } # 3. Backend API location /api/ { proxy_pass http://bindbox-game:9991/api/; 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; } # 4. Nakama API (HTTP / GRPC / WebSocket) location /v2/ { proxy_pass http://nakama:7350/v2/; 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; } # Nakama WebSocket location /ws { proxy_pass http://nakama:7350/ws; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } # Nginx 状态监控端点(仅内网访问) location /nginx_status { stub_status on; access_log off; allow 172.0.0.0/8; # Docker 内网 allow 10.0.0.0/8; # 内网 allow 127.0.0.1; deny all; } }