Created
December 27, 2020 14:29
-
-
Save ezhevita/c1fac65144a753da207f0e7b26551d6c to your computer and use it in GitHub Desktop.
Nginx configuration for hosting multiple instances of ASF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http { | |
map $request_uri $instance_port { | |
default 0; | |
"~*^/0" 1240; | |
"~*^/1" 1242; | |
"~*^/2" 1243; | |
"~*^/3" 1244; | |
"~*^/4" 1235; | |
"~*^/5" 1234; | |
"~*^/6" 1233; | |
"~*^/7" 1232; | |
"~*^/8" 1231; | |
"~*^/9" 1337; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name *.example.com; | |
# enforce https | |
return 301 https://$host$request_uri; | |
} | |
server { | |
listen 443 ssl; | |
server_name example.com; | |
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; | |
error_page 497 https://$host:$server_port$request_uri; | |
proxy_read_timeout 30m; | |
proxy_set_header Host asf.example.com; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Host $host:$server_port; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
location ~* /Api/NLog { | |
proxy_pass http://127.0.0.1:$instance_port; | |
proxy_http_version 1.1; | |
proxy_set_header Connection "Upgrade"; | |
proxy_set_header Upgrade $http_upgrade; | |
} | |
location / { | |
proxy_pass http://127.0.0.1:$instance_port; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment