David Moreau Simard f61531ab9a
Rename the ara role to ara_api and move nginx out to it's own role
Moving nginx out to it's own role allows us to re-use it for ara-web.
Renaming ara to ara_api and namespacing it's variables helps removing
ambiguities and opportunities for clashing names.

Change-Id: Ie1fc53fa25b00bc86aafda708df9866f02ced6fd
2019-03-07 19:53:00 -05:00

40 lines
1.1 KiB
Django/Jinja

upstream ara_api {
# fail_timeout=0 means we always retry an upstream even if it failed
# to return a good HTTP response
server {{ ara_api_wsgi_bind }} fail_timeout=0;
}
server {
listen 80;
keepalive_timeout 5;
server_name {{ ara_api_fqdn }};
access_log /var/log/nginx/{{ ara_api_fqdn }}_access.log;
error_log /var/log/nginx/{{ ara_api_fqdn }}_error.log;
# There's nothing at /, redirect it to the actual API for convenience
location / {
return 301 http://{{ ara_api_fqdn }}/api/v1/;
}
location /static {
expires 7d;
add_header Cache-Control "public";
}
# Everything, including static files, is served by the backend
location ~ {
# checks if the file exists, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://ara_api;
}
}