karrot/nginx.conf.tmpl

67 lines
1.5 KiB
Cheetah
Raw Normal View History

2022-09-25 17:24:23 +00:00
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name {{ env "DOMAIN" }};
root /usr/share/nginx/html;
location / {
try_files $uri /index.html;
if_modified_since off;
expires off;
etag off;
# TODO: csp headers
}
location /css {
expires max;
}
location /js {
expires max;
}
location /img {
expires max;
}
location /fonts {
expires max;
}
# /app/uploads
location /media/ {
alias /app/uploads/;
expires max;
}
location /community_proxy/ {
proxy_pass https://community.foodsaving.world/;
}
2022-09-25 18:24:25 +00:00
error_page 405 =200 $uri;
2022-09-25 17:24:23 +00:00
location ^\/(api(\-auth)?|docs|silk)\/ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
# this port is whatever port 80 is mapped to outside the container
2022-09-25 18:24:25 +00:00
proxy_set_header Host $host:80;
2022-09-25 17:24:23 +00:00
proxy_pass http://app:8000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Sec-WebSocket-Extensions $http_sec_websocket_extensions;
proxy_set_header Sec-WebSocket-Key $http_sec_websocket_key;
proxy_set_header Sec-WebSocket-Protocol $http_sec_websocket_protocol;
proxy_set_header Sec-WebSocket-Version $http_sec_websocket_version;
}
}