mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 16:30:16 +00:00
82 lines
2.4 KiB
Nginx Configuration File
82 lines
2.4 KiB
Nginx Configuration File
# Map URI to ports
|
|
map $uri $port {
|
|
~^/w0/ 3001;
|
|
~^/w1/ 3002;
|
|
~^/w2/ 3003;
|
|
~^/w3/ 3004;
|
|
~^/w4/ 3005;
|
|
~^/w5/ 3006;
|
|
~^/w6/ 3007;
|
|
~^/w7/ 3008;
|
|
~^/w8/ 3009;
|
|
~^/w9/ 3010;
|
|
~^/w10/ 3011;
|
|
~^/w11/ 3012;
|
|
~^/w12/ 3013;
|
|
~^/w13/ 3014;
|
|
~^/w14/ 3015;
|
|
default 3000;
|
|
}
|
|
|
|
# WebSocket settings
|
|
map $http_upgrade $connection_upgrade {
|
|
default upgrade;
|
|
'' close;
|
|
}
|
|
|
|
# WebSocket path handling
|
|
map $uri $uri_path {
|
|
~^/w\d+(/.*)?$ $1;
|
|
default $uri;
|
|
}
|
|
|
|
server {
|
|
listen 80 default_server;
|
|
|
|
# Logging
|
|
access_log /var/log/nginx/access.log;
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
# Main location
|
|
location / {
|
|
proxy_pass http://127.0.0.1:3000;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $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;
|
|
}
|
|
|
|
# Worker locations
|
|
location ~* ^/w(\d+)(/.*)?$ {
|
|
set $worker $1;
|
|
set $worker_port 3001;
|
|
|
|
if ($worker = "0") { set $worker_port 3001; }
|
|
if ($worker = "1") { set $worker_port 3002; }
|
|
if ($worker = "2") { set $worker_port 3003; }
|
|
if ($worker = "3") { set $worker_port 3004; }
|
|
if ($worker = "4") { set $worker_port 3005; }
|
|
if ($worker = "5") { set $worker_port 3006; }
|
|
if ($worker = "6") { set $worker_port 3007; }
|
|
if ($worker = "7") { set $worker_port 3008; }
|
|
if ($worker = "8") { set $worker_port 3009; }
|
|
if ($worker = "9") { set $worker_port 3010; }
|
|
if ($worker = "10") { set $worker_port 3011; }
|
|
if ($worker = "11") { set $worker_port 3012; }
|
|
if ($worker = "12") { set $worker_port 3013; }
|
|
if ($worker = "13") { set $worker_port 3014; }
|
|
if ($worker = "14") { set $worker_port 3015; }
|
|
|
|
proxy_pass http://127.0.0.1:$worker_port$2;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $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;
|
|
}
|
|
} |