nginx.conf 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
upstream api {
    server localhost:6001;
}

server {
    listen      80;
    server_name demo.funkwhale.audio;
    ## redirect http to https ##
    rewrite        ^ https://$server_name$request_uri? permanent;
}

server {
    server_name demo.funkwhale.audio;
    listen   443;

    ssl on;
    ssl_certificate      /etc/ssl/demo.funkwhale.audio/domain.crt;
    ssl_certificate_key  /etc/ssl/demo.funkwhale.audio/domain.key;

    root /srv/funkwhale-demo/front/dist;

    location / {
        try_files $uri $uri/ @rewrites;
    }

    location @rewrites {
        rewrite ^(.+)$ /index.html last;
    }
    location /api {
        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 https;
        proxy_redirect off;
        proxy_pass   http://api/;
    }
    location /media/ {
        alias /srv/funkwhale-demo/api/media/;
    }
    location /staticfiles/ {
        alias /srv/funkwhale-demo/api/staticfiles/;
    }
}