diff -r e7c7e6e0a8bc -r 62bffc051e1c deploy/templates/nginx.static.conf.j2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deploy/templates/nginx.static.conf.j2 Wed Nov 28 15:45:37 2018 +0100 @@ -0,0 +1,46 @@ +upstream {{backend_upstream_name}} { + server {{backend_host}}:{{backend_port}}; + server 127.0.0.1 backup; +} + + +server { + listen 80; + listen [::]:80; + + server_name {{static_server_name}}; + + access_log /var/log/nginx/{{static_server_name}}-access.log; + error_log /var/log/nginx/{{static_server_name}}-error.log; + + root {{remote_static_path}}/; + index index.html index.htm; + + + location {{backend_url}}/api { + uwsgi_pass {{backend_upstream_name}}; + include /etc/nginx/uwsgi_params; + } + location {{backend_url}}/admin { + uwsgi_pass {{backend_upstream_name}}; + include /etc/nginx/uwsgi_params; + } + location {{backend_url}}/auth { + uwsgi_pass {{backend_upstream_name}}; + include /etc/nginx/uwsgi_params; + } + + location /backend/static { + alias {{backend_nginx_static_root}}; # backend static files + } + + location /backend/media { + alias {{backend_nginx_media_root}}; # backend media files + } + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ /index.html; + } +}