Files
justice/www/html/Game/public/trycss/game-justic2/server/nginx-fix-realtimechat-404.conf
T
2026-05-27 04:30:21 +00:00

39 lines
1.4 KiB
Plaintext

# ใส่ใน server { } ของ srv1361159.hstgr.cloud
# ไฟล์ config มักอยู่ที่: /etc/nginx/sites-available/srv1361159.hstgr.cloud
# Serve ไฟล์ static ของ realtimechat (index.html ฯลฯ)
location /realtimechat/ {
alias /var/www/html/realtimechat/public/;
index index.html;
try_files $uri $uri/ /realtimechat/index.html;
}
# Socket.IO ต้องไปที่ Node (พอร์ต 3000)
location /realtimechat/socket.io/ {
proxy_pass http://127.0.0.1:3000;
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;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# --- Game (ถ้าต้องการแก้ด้วย) ---
location /Game/ {
alias /var/www/html/Game/public/;
index index.html;
try_files $uri $uri/ /Game/index.html;
}
location /Game/socket.io/ {
proxy_pass http://127.0.0.1:3001;
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;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}