2022-11-22 19:23:13 +00:00
|
|
|
# This file was generated from Funkwhale's nginx.template
|
2017-07-17 20:00:32 +00:00
|
|
|
|
2017-06-25 21:02:36 +00:00
|
|
|
upstream funkwhale-api {
|
2018-09-13 15:31:06 +00:00
|
|
|
# depending on your setup, you may want to update this
|
2018-08-31 17:21:46 +00:00
|
|
|
server ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT};
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
server {
|
2017-07-17 20:00:32 +00:00
|
|
|
listen 80;
|
|
|
|
listen [::]:80;
|
|
|
|
# update this to match your instance name
|
2018-08-31 17:21:46 +00:00
|
|
|
server_name ${FUNKWHALE_HOSTNAME};
|
2022-11-22 19:23:13 +00:00
|
|
|
|
2017-07-17 20:00:32 +00:00
|
|
|
# useful for Let's Encrypt
|
2022-11-22 19:23:13 +00:00
|
|
|
location /.well-known/acme-challenge/ {
|
|
|
|
allow all;
|
|
|
|
}
|
|
|
|
|
|
|
|
location / {
|
|
|
|
return 301 https://$host$request_uri;
|
|
|
|
}
|
2017-06-26 12:09:47 +00:00
|
|
|
}
|
|
|
|
|
2022-11-22 19:23:13 +00:00
|
|
|
# Required for websocket support.
|
2018-03-03 22:18:33 +00:00
|
|
|
map $http_upgrade $connection_upgrade {
|
|
|
|
default upgrade;
|
|
|
|
'' close;
|
|
|
|
}
|
|
|
|
|
2017-06-26 12:09:47 +00:00
|
|
|
server {
|
2019-10-04 07:03:42 +00:00
|
|
|
listen 443 ssl http2;
|
|
|
|
listen [::]:443 ssl http2;
|
2022-11-22 19:23:13 +00:00
|
|
|
charset utf-8;
|
2018-08-31 17:21:46 +00:00
|
|
|
server_name ${FUNKWHALE_HOSTNAME};
|
2017-06-25 21:02:36 +00:00
|
|
|
|
2017-06-26 12:09:47 +00:00
|
|
|
# TLS
|
2017-07-17 20:00:32 +00:00
|
|
|
# Feel free to use your own configuration for SSL here or simply remove the
|
|
|
|
# lines and move the configuration to the previous server block if you
|
2018-06-25 21:48:28 +00:00
|
|
|
# don't want to run funkwhale behind https (this is not recommended)
|
2017-07-17 20:00:32 +00:00
|
|
|
# have a look here for let's encrypt configuration:
|
|
|
|
# https://certbot.eff.org/all-instructions/#debian-9-stretch-nginx
|
2017-06-26 12:09:47 +00:00
|
|
|
ssl_protocols TLSv1.2;
|
|
|
|
ssl_ciphers HIGH:!MEDIUM:!LOW:!aNULL:!NULL:!SHA;
|
|
|
|
ssl_prefer_server_ciphers on;
|
|
|
|
ssl_session_cache shared:SSL:10m;
|
2018-08-31 17:21:46 +00:00
|
|
|
ssl_certificate /etc/letsencrypt/live/${FUNKWHALE_HOSTNAME}/fullchain.pem;
|
|
|
|
ssl_certificate_key /etc/letsencrypt/live/${FUNKWHALE_HOSTNAME}/privkey.pem;
|
2022-11-22 19:23:13 +00:00
|
|
|
|
2017-06-26 12:09:47 +00:00
|
|
|
# HSTS
|
|
|
|
add_header Strict-Transport-Security "max-age=31536000";
|
|
|
|
|
2022-11-22 19:23:13 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; connect-src https: wss: http: ws: 'self' 'unsafe-eval'; script-src 'self' 'wasm-unsafe-eval'; style-src https: http: 'self' 'unsafe-inline'; img-src https: http: 'self' data:; font-src https: http: 'self' data:; media-src https: http: 'self' data:; object-src 'none'";
|
2019-07-18 09:08:18 +00:00
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
2021-10-20 18:59:00 +00:00
|
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
2022-11-22 19:23:13 +00:00
|
|
|
add_header Service-Worker-Allowed "/";
|
2019-07-10 13:11:29 +00:00
|
|
|
|
2018-08-31 17:21:46 +00:00
|
|
|
root ${FUNKWHALE_FRONTEND_PATH};
|
2017-06-25 21:02:36 +00:00
|
|
|
|
2018-12-19 22:46:53 +00:00
|
|
|
# compression settings
|
|
|
|
gzip on;
|
|
|
|
gzip_comp_level 5;
|
|
|
|
gzip_min_length 256;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_vary on;
|
|
|
|
|
|
|
|
gzip_types
|
|
|
|
application/javascript
|
|
|
|
application/vnd.geo+json
|
|
|
|
application/vnd.ms-fontobject
|
|
|
|
application/x-font-ttf
|
|
|
|
application/x-web-app-manifest+json
|
|
|
|
font/opentype
|
|
|
|
image/bmp
|
|
|
|
image/svg+xml
|
|
|
|
image/x-icon
|
|
|
|
text/cache-manifest
|
|
|
|
text/css
|
|
|
|
text/plain
|
|
|
|
text/vcard
|
|
|
|
text/vnd.rim.location.xloc
|
|
|
|
text/vtt
|
|
|
|
text/x-component
|
|
|
|
text/x-cross-domain-policy;
|
|
|
|
# end of compression settings
|
2021-10-20 18:59:00 +00:00
|
|
|
|
2022-10-22 13:45:16 +00:00
|
|
|
location /api/ {
|
2018-03-04 15:58:37 +00:00
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
2022-11-22 19:23:13 +00:00
|
|
|
# This is needed if you have file import via upload enabled.
|
2018-08-31 17:21:46 +00:00
|
|
|
client_max_body_size ${NGINX_MAX_BODY_SIZE};
|
2022-12-06 14:29:09 +00:00
|
|
|
proxy_pass http://funkwhale-api;
|
2018-12-19 13:04:26 +00:00
|
|
|
}
|
|
|
|
|
2022-10-22 13:45:16 +00:00
|
|
|
location / {
|
2018-12-19 14:35:23 +00:00
|
|
|
alias ${FUNKWHALE_FRONTEND_PATH}/;
|
2022-11-22 19:23:13 +00:00
|
|
|
expires 1d;
|
2022-10-22 13:45:16 +00:00
|
|
|
try_files $uri $uri/ /index.html;
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
2022-11-22 19:23:13 +00:00
|
|
|
|
2022-11-26 20:27:40 +00:00
|
|
|
location = /embed.html {
|
2022-11-22 19:23:13 +00:00
|
|
|
add_header Content-Security-Policy "connect-src https: http: 'self'; default-src 'self'; script-src 'self' unpkg.com 'unsafe-inline' 'unsafe-eval'; style-src https: http: 'self' 'unsafe-inline'; img-src https: http: 'self' data:; font-src https: http: 'self' data:; object-src 'none'; media-src https: http: 'self' data:";
|
2019-07-18 09:08:18 +00:00
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
|
|
|
|
|
|
|
alias ${FUNKWHALE_FRONTEND_PATH}/embed.html;
|
2022-11-22 19:23:13 +00:00
|
|
|
expires 1d;
|
2019-07-18 09:08:18 +00:00
|
|
|
}
|
2018-02-19 19:20:49 +00:00
|
|
|
|
2018-03-29 21:38:33 +00:00
|
|
|
location /federation/ {
|
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
2022-12-06 14:29:09 +00:00
|
|
|
proxy_pass http://funkwhale-api;
|
2018-03-29 21:38:33 +00:00
|
|
|
}
|
|
|
|
|
2022-11-22 19:23:13 +00:00
|
|
|
# You can comment this if you do not plan to use the Subsonic API.
|
2018-05-29 16:12:46 +00:00
|
|
|
location /rest/ {
|
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
|
|
|
proxy_pass http://funkwhale-api/api/subsonic/rest/;
|
|
|
|
}
|
|
|
|
|
2018-05-07 20:29:22 +00:00
|
|
|
location /.well-known/ {
|
2018-03-29 21:38:33 +00:00
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
2022-12-06 14:29:09 +00:00
|
|
|
proxy_pass http://funkwhale-api;
|
2018-03-29 21:38:33 +00:00
|
|
|
}
|
|
|
|
|
2017-06-25 21:02:36 +00:00
|
|
|
location /media/ {
|
2018-08-31 17:21:46 +00:00
|
|
|
alias ${MEDIA_ROOT}/;
|
2022-11-05 17:53:22 +00:00
|
|
|
add_header Access-Control-Allow-Origin '*';
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
2017-06-28 21:30:26 +00:00
|
|
|
|
2022-11-22 19:23:13 +00:00
|
|
|
# This is an internal location that is used to serve
|
|
|
|
# media (uploaded) files once correct permission / authentication
|
|
|
|
# has been checked on API side.
|
|
|
|
# Comment the "NON-S3" commented lines and uncomment "S3" commented lines
|
|
|
|
# if you're storing media files in a S3 bucket.
|
|
|
|
location ~ /_protected/media/(.+) {
|
2018-06-19 08:13:34 +00:00
|
|
|
internal;
|
2022-11-22 19:23:13 +00:00
|
|
|
alias ${MEDIA_ROOT}/$1; # NON-S3
|
|
|
|
# Needed to ensure DSub auth isn't forwarded to S3/Minio, see #932.
|
|
|
|
# proxy_set_header Authorization ""; # S3
|
|
|
|
# proxy_pass $1; # S3
|
2022-11-05 17:53:22 +00:00
|
|
|
add_header Access-Control-Allow-Origin '*';
|
2018-06-19 08:13:34 +00:00
|
|
|
}
|
2019-07-10 13:11:29 +00:00
|
|
|
|
2022-04-26 16:03:09 +00:00
|
|
|
location /_protected/music/ {
|
2022-11-22 19:23:13 +00:00
|
|
|
# This is an internal location that is used to serve
|
|
|
|
# local music files once correct permission / authentication
|
|
|
|
# has been checked on API side.
|
|
|
|
# Set this to the same value as your MUSIC_DIRECTORY_PATH setting.
|
2018-04-21 17:30:55 +00:00
|
|
|
internal;
|
2018-08-31 17:21:46 +00:00
|
|
|
alias ${MUSIC_DIRECTORY_SERVE_PATH};
|
2022-11-05 17:53:22 +00:00
|
|
|
add_header Access-Control-Allow-Origin '*';
|
2018-04-21 17:30:55 +00:00
|
|
|
}
|
2022-12-02 14:06:38 +00:00
|
|
|
|
|
|
|
location /manifest.json {
|
2022-12-04 12:52:17 +00:00
|
|
|
return 302 /api/v1/instance/spa-manifest.json;
|
|
|
|
}
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|