44 lines
1.3 KiB
Django/Jinja
44 lines
1.3 KiB
Django/Jinja
server {
|
|
listen 443 ssl;
|
|
server_name {{nginx_host_pattern}};
|
|
|
|
ssl_certificate {{ssl_certificate}};
|
|
ssl_certificate_key {{ssl_certificate_key}};
|
|
|
|
access_log {{nginx_log_base}}-access.log combined;
|
|
error_log {{nginx_log_base}}-error.log;
|
|
|
|
location ~ ^/static/(.+)$ {
|
|
root /;
|
|
try_files {{tenants_dir}}/$host/static/$1
|
|
{{tenants_dir}}/$host/theme/static/$1
|
|
{{state_dir}}/collectstatic/$1
|
|
=404;
|
|
add_header Access-Control-Allow-Origin *;
|
|
add_header 'Service-Worker-Allowed' '/';
|
|
}
|
|
|
|
location ~ ^/media/(.+)$ {
|
|
alias {{tenants_dir}}/$host/media/$1;
|
|
}
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:{{server_port}};
|
|
proxy_set_header Host $http_host;
|
|
proxy_set_header X-Forwarded-SSL on;
|
|
proxy_set_header X-Forwarded-Protocol ssl;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
}
|
|
|
|
# catchall http → https
|
|
server {
|
|
listen 80;
|
|
server_name {{nginx_host_pattern}};
|
|
access_log {{nginx_log_base}}-access.log combined;
|
|
error_log {{nginx_log_base}}-error.log;
|
|
return 301 https://$host$request_uri;
|
|
}
|