# Reverse proxy for Evection. Copy to /etc/nginx/sites-available/evection, # adjust server_name and the certificate paths (certbot will fill those in # for you if you use `certbot --nginx`), then symlink into sites-enabled. server { listen 80; listen [::]:80; server_name your-domain.example; # certbot --nginx adds the HTTPS server block and redirects here # automatically; until then this serves plain HTTP. location / { return 301 https://$host$request_uri; } } server { listen 443 ssl; listen [::]:443 ssl; server_name your-domain.example; ssl_certificate /etc/letsencrypt/live/your-domain.example/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/your-domain.example/privkey.pem; client_max_body_size 10M; # OPML uploads are small, but leave headroom location /static/ { alias /opt/evection/app/staticfiles/; expires 30d; add_header Cache-Control "public, immutable"; } # The service worker must be served from the domain root with the right # scope header for its Service-Worker-Allowed: / to take effect — it's # already a normal Django view (see apps.pwa), proxied like everything # else below, so no special-casing is needed here. location / { proxy_pass http://unix:/run/evection/gunicorn.sock; 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-Proto $scheme; } }