For anyone else trying to set up multiple servers with nginx serving as reverse proxy:
I ended up using the subdomains like Chris suggested. The nginx config for each otree server is as follows:
If you have for example one of your otree servers running on
page.com:8002, and would like them to run on
otree1.page.com, you would use the following config:
server {
listen 80;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
If you want to set up multiple subdomains for multiple servers, just copy the above code for every server, changing the bolded parts.
Important: Make sure you actually have DNS redirecting all subdomains to your server (
page.com), otherwise this will obviously not work. I spent more time than I'd like to admit debugging my server while the problem was with my DNS redirects.
Good luck. :)
Rok