This commit is contained in:
j 2021-11-12 17:03:13 +00:00
parent 1351febef1
commit 6565265057
2 changed files with 83 additions and 0 deletions

View file

@ -0,0 +1,69 @@
upstream django-backend {
server 127.0.0.1:8080;
}
server {
listen 80;
listen [::]:80;
location /.well-known/ {
root /var/www/html;
autoindex off;
}
rewrite ^/(.*) https://event-timeline/$1 permanent;
}
server {
server_tokens off;
server_name event-timeline;
listen 443 ssl http2;
listen [::]:443 ssl http2;
ssl_trusted_certificate /etc/letsencrypt/live/event-timeline/chain.pem;
ssl_certificate /etc/letsencrypt/live/event-timeline/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/event-timeline/privkey.pem;
#include /etc/letsencrypt/nginx.conf;
location /favicon.ico {
root /srv/event-timeline/www/static;
}
location /media/ {
root /srv/event-timeline/data/;
}
location /static/ {
root /srv/event-timeline/www/;
}
location / {
root /srv/event-timeline/public;
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_pass http://django-backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
client_max_body_size 32m;
}
error_page 400 /;
error_page 404 /404.html;
location /404.html {
root /srv/event-timeline/www/static/html;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location /50x.html {
root /srv/event-timeline/www/static/html;
}
}

View file

@ -0,0 +1,14 @@
[Unit]
Description=event-timeline
[Service]
Type=simple
Restart=always
User=event-timeline
Group=event-timeline
WorkingDirectory=/srv/event-timeline
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/srv/event-timeline/venv/bin/gunicorn app.wsgi:application --reuse-port -b 127.0.0.1:8080
[Install]
WantedBy=multi-user.target