# This is the nginx config that we (starkingdoms) use in production. # To use this for yourself, replace `YOURDOMAIN` with your domain (ie: starkingdoms.io, bleeding.starkingdoms.io, etc) # and replace YOURSERVERIP with the IP that the server is hosted on (for local, use 127.0.0.1) # Ports are the same as the ones deployed by the scripts in /ansible/. # You can use this as a guide to write your own config. Be aware that the game will not function very well if there is # high CPU usage on the proxy server, as nginx will struggle to proxy the websocket connection. # Put this on an at-least-semi-decent server. # Game pings, game stream and static assets are on the primary domain (ex: bleeding.starkingdoms.io) server { server_name YOURDOMAIN; # Static assets should be routed to the nginx container which can handle the traffic location / { proxy_set_header Host $host; # Very important (security, logins will break without this), do not remove proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://YOURSERVERIP:3206; # Web port is 3206 with the provided ansible files } # Websockets should be upgraded and forwarded to the game server location /ws { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Connection "Upgrade"; proxy_set_header Upgrade $http_upgrade; proxy_pass http://YOURSERVERIP:3204; # Game server is 3204 with the provided ansible files } # Pings to the game server should be routed there too location /ping { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://YOURSERVERIP:3204; } } # API is on a secondary domain (api.bleeding.starkingdoms.io) server { server_name api.YOURDOMAIN.COM; location / { proxy_set_header Host $host; # Very important (security), do not remove proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Very important (security), do not remove proxy_pass http://YOURSERVERIP:3205; # API server is 3205 with the provided ansible files } }