Files
restitution/nginx.conf
kaykayyali a052e89151 fix: Phaser renders on game start, static assets served correctly
- app.jsx: mount Phaser in useEffect (not render), import Phaser properly
- webpack: add CopyWebpackPlugin to bundle public/ assets into dist/
- nginx: serve .tmj/.json/.png game assets as static files (not proxied)
- colyseus.js: pin to 0.15 to match server @colyseus/schema 2.x
- Result: zero JS errors, tilemap loads, Phaser canvas renders
2026-05-30 03:09:56 +00:00

56 lines
1.4 KiB
Nginx Configuration File

map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Static assets served directly (JS, CSS, fonts, images, game assets)
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|map|txt|LICENSE|tmj|tmx|json|atlas|xml|wav|mp3|ogg|webp)$ {
try_files $uri =404;
expires 1y;
add_header Cache-Control "public, immutable";
}
# SPA entry point
location = /index.html {
try_files $uri =404;
}
# API routes (REST)
location /api/ {
proxy_pass http://backend:8081;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
# Colyseus matchmaking HTTP endpoint
location /matchmake/ {
proxy_pass http://backend:8081;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
# WebSocket + Colyseus room paths
location / {
proxy_pass http://backend:8081;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $host;
proxy_read_timeout 86400s;
proxy_intercept_errors on;
error_page 400 401 403 404 405 = @spa;
}
location @spa {
root /usr/share/nginx/html;
try_files /index.html =500;
}
}