Skip to content

Home Information - Your home, your data, organized.

Python
2.0 KB
Raw Blame
upstream wsgi_server {
  server unix:/var/run/gunicorn.sock fail_timeout=0;
}

server {

    listen 0.0.0.0:8000;
    listen [::]:8000;
    server_name wsgi_server;
    
    server_tokens off;
    add_header X-XSS-Protection "1; mode=block";
    add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains;';
    add_header Permissions-Policy "geolocation=(self),autoplay=(self),camera=(),accelerometer=(),magnetometer=(self),ambient-light-sensor=(),gyroscope=(self),speaker=(self),vibrate=(self),fullscreen=(self),midi=(),encrypted-media=(),microphone=(),usb=(),picture-in-picture=(),vr=()";

    client_max_body_size 20M;

    location /favicon.ico {
        alias /src/static/favicon.ico;
        access_log off;
        log_not_found off;
    }

    location /static/ {
        add_header Referrer-Policy "strict-origin";
        add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; connect-src 'self'; img-src 'self'; form-action 'self'; frame-ancestors 'self'; frame-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; manifest-src 'self'; font-src 'self'; style-src 'self' 'unsafe-inline' 'unsafe-eval';";
        add_header X-Content-Type-Options "nosniff";
        alias   /src/static/;
        autoindex off;
    }
        
    location /media/ {
        add_header Referrer-Policy "strict-origin";
        add_header Content-Security-Policy "default-src 'self'; base-uri 'self'; connect-src 'self'; img-src 'self'; form-action 'self'; frame-ancestors 'self'; frame-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; manifest-src 'self'; font-src 'self'; style-src 'self' 'unsafe-inline' 'unsafe-eval';";
        add_header X-Content-Type-Options "nosniff";
        alias   /data/media/;
        autoindex off;
    }
        
    location / {
        index index.html;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;

        proxy_redirect off;

        proxy_pass http://wsgi_server;
    }

}