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 api:5000;
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 12:09:47 +00:00
|
|
|
|
2018-03-03 22:18:33 +00:00
|
|
|
# required for websocket support
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
|
|
default upgrade;
|
|
|
|
'' close;
|
|
|
|
}
|
|
|
|
|
2017-06-26 12:09:47 +00:00
|
|
|
server {
|
2018-08-31 17:21:46 +00:00
|
|
|
listen 80;
|
|
|
|
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
|
|
|
|
2018-08-31 17:21:46 +00:00
|
|
|
root /frontend;
|
2017-06-25 21:02:36 +00:00
|
|
|
|
2019-08-19 08:09:08 +00:00
|
|
|
# If you are using S3 to host your files, remember to add your S3 URL to the
|
|
|
|
# media-src and img-src headers (e.g. img-src 'self' https://<your-S3-URL> data:)
|
|
|
|
|
2019-07-18 09:08:18 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; media-src 'self' data:";
|
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
|
|
|
|
|
|
|
|
2017-06-25 21:02:36 +00:00
|
|
|
location / {
|
2018-03-04 15:58:37 +00:00
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
2017-12-27 22:32:02 +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};
|
2018-12-19 13:04:26 +00:00
|
|
|
proxy_pass http://funkwhale-api/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /front/ {
|
2019-07-18 09:08:18 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; media-src 'self' data:";
|
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
2020-01-09 14:23:37 +00:00
|
|
|
add_header Service-Worker-Allowed "/";
|
2019-07-18 09:08:18 +00:00
|
|
|
add_header X-Frame-Options "ALLOW";
|
2018-12-19 14:35:23 +00:00
|
|
|
alias /frontend/;
|
2018-12-20 14:59:55 +00:00
|
|
|
expires 30d;
|
|
|
|
add_header Pragma public;
|
|
|
|
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
2018-02-19 19:20:49 +00:00
|
|
|
|
2019-07-18 09:08:18 +00:00
|
|
|
location /front/embed.html {
|
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; media-src 'self' data:";
|
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
|
|
|
|
|
|
|
add_header X-Frame-Options "ALLOW";
|
|
|
|
alias /frontend/embed.html;
|
|
|
|
expires 30d;
|
|
|
|
add_header Pragma public;
|
|
|
|
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
|
|
|
}
|
|
|
|
|
2018-03-29 21:38:33 +00:00
|
|
|
location /federation/ {
|
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
|
|
|
proxy_pass http://funkwhale-api/federation/;
|
|
|
|
}
|
|
|
|
|
2018-05-29 16:12:46 +00:00
|
|
|
# You can comment this if you do not plan to use the Subsonic API
|
|
|
|
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;
|
2018-05-07 20:29:22 +00:00
|
|
|
proxy_pass http://funkwhale-api/.well-known/;
|
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}/;
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
2017-06-28 21:30:26 +00:00
|
|
|
|
2019-04-23 16:00:00 +00:00
|
|
|
# this is an internal location that is used to serve
|
|
|
|
# audio files once correct permission / authentication
|
|
|
|
# has been checked on API side
|
2018-06-19 08:13:34 +00:00
|
|
|
location /_protected/media {
|
|
|
|
internal;
|
2018-08-31 17:21:46 +00:00
|
|
|
alias ${MEDIA_ROOT};
|
2019-04-23 16:00:00 +00:00
|
|
|
|
2018-06-19 08:13:34 +00:00
|
|
|
}
|
2019-04-23 16:00:00 +00:00
|
|
|
# Comment the previous location and uncomment this one if you're storing
|
|
|
|
# media files in a S3 bucket
|
|
|
|
# location ~ /_protected/media/(.+) {
|
|
|
|
# internal;
|
2019-10-03 08:58:20 +00:00
|
|
|
# # Needed to ensure DSub auth isn't forwarded to S3/Minio, see #932
|
|
|
|
# proxy_set_header Authorization "";
|
2019-04-23 16:00:00 +00:00
|
|
|
# proxy_pass $1;
|
|
|
|
# }
|
2018-06-19 08:13:34 +00:00
|
|
|
|
2018-04-21 17:30:55 +00:00
|
|
|
location /_protected/music {
|
|
|
|
# this is an internal location that is used to serve
|
|
|
|
# audio files once correct permission / authentication
|
|
|
|
# has been checked on API side
|
2018-06-10 20:51:24 +00:00
|
|
|
# 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_PATH};
|
2018-04-21 17:30:55 +00:00
|
|
|
}
|
|
|
|
|
2017-06-25 21:02:36 +00:00
|
|
|
location /staticfiles/ {
|
2017-06-28 21:30:26 +00:00
|
|
|
# django static files
|
2018-08-31 17:21:46 +00:00
|
|
|
alias ${STATIC_ROOT}/;
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
|
|
|
}
|