Skip to content
Snippets Groups Projects
nginx.conf 1.52 KiB
Newer Older
asmundh's avatar
asmundh committed
user              nginx;
worker_processes  1;
error_log         /var/log/nginx/error.log warn;
pid               /var/run/nginx.pid;
load_module modules/ngx_http_perl_module.so;

env GROUPID;
env PORT_PREFIX;

events {
    worker_connections  1024;
}

http {

    perl_set $GROUPID 'sub { return $ENV{"GROUPID"}; }';
    perl_set $PORT_PREFIX 'sub { return $ENV{"PORT_PREFIX"}; }';
    client_max_body_size 100M;

    server {
      listen       80;
      server_name  localhost;

      location / {
        proxy_pass http://10.${GROUPID}.0.5:3000;
        proxy_http_version 1.1;
        proxy_set_header Host $host:${PORT_PREFIX}${GROUPID};
      }
      location /api/ {
        proxy_pass http://10.${GROUPID}.0.4:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host:${PORT_PREFIX}${GROUPID};
      }
      location /api/root/ {
        proxy_pass http://10.${GROUPID}.0.4:8000/;
        proxy_http_version 1.1;
        proxy_set_header Host $host:${PORT_PREFIX}${GROUPID};
      }
      location /admin/ {
        proxy_pass http://10.${GROUPID}.0.4:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host:${PORT_PREFIX}${GROUPID};
      }
      location /static/ {
        proxy_pass http://10.${GROUPID}.0.4:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host:${PORT_PREFIX}${GROUPID};
      }
      location /media/ {
        proxy_pass http://10.${GROUPID}.0.4:8000;
        proxy_http_version 1.1;
        proxy_set_header Host $host:${PORT_PREFIX}${GROUPID};
      }
      
    }
}