2017-06-25 21:02:36 +00:00
|
|
|
upstream funkwhale-api {
|
2022-07-09 13:42:56 +00:00
|
|
|
server ${FUNKWHALE_API_HOST}:${FUNKWHALE_API_PORT};
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
|
|
|
|
2017-06-26 12:09:47 +00:00
|
|
|
|
2022-07-19 23:31:28 +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 {
|
2018-08-31 17:21:46 +00:00
|
|
|
listen 80;
|
|
|
|
server_name ${FUNKWHALE_HOSTNAME};
|
2017-06-25 21:02:36 +00:00
|
|
|
|
2022-06-28 13:55:54 +00:00
|
|
|
root /usr/share/nginx/html;
|
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
|
2022-07-19 23:31:28 +00:00
|
|
|
# media-src and img-src headers (e.g. img-src 'self' https://<your-S3-URL> data:).
|
2019-08-19 08:09:08 +00:00
|
|
|
|
2022-06-28 13:55:54 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' ${AWS_S3_ENDPOINT_URL} data:; font-src 'self' data:; object-src 'none'; media-src ${AWS_S3_ENDPOINT_URL} 'self' data:";
|
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;
|
2019-07-18 09:08:18 +00:00
|
|
|
|
2017-06-25 21:02:36 +00:00
|
|
|
location / {
|
2018-03-04 15:58:37 +00:00
|
|
|
include /etc/nginx/funkwhale_proxy.conf;
|
2022-07-19 23:31:28 +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/ {
|
2022-06-28 13:55:54 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' ${AWS_S3_ENDPOINT_URL} data:; font-src 'self' data:; object-src 'none'; media-src ${AWS_S3_ENDPOINT_URL} 'self' data:";
|
2019-07-18 09:08:18 +00:00
|
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin";
|
2020-01-09 14:23:37 +00:00
|
|
|
add_header Service-Worker-Allowed "/";
|
2022-06-28 13:55:54 +00:00
|
|
|
alias /usr/share/nginx/html/;
|
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
|
|
|
|
2022-04-26 16:03:09 +00:00
|
|
|
location = /front/embed.html {
|
2022-07-19 23:31:28 +00:00
|
|
|
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' ${AWS_S3_ENDPOINT_URL} data:; font-src 'self' data:; object-src 'none'; media-src ${AWS_S3_ENDPOINT_URL} 'self' data:";
|
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 "" always;
|
2022-06-28 13:55:54 +00:00
|
|
|
alias /usr/share/nginx/html/embed.html;
|
2019-07-18 09:08:18 +00:00
|
|
|
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/;
|
|
|
|
}
|
|
|
|
|
2022-07-19 23:31:28 +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;
|
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
|
|
|
|
2022-07-19 23:31:28 +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.
|
2022-07-26 21:25:14 +00:00
|
|
|
location ~ /_protected/media/(.+) {
|
2018-06-19 08:13:34 +00:00
|
|
|
internal;
|
2022-07-26 21:25:14 +00:00
|
|
|
alias ${MEDIA_ROOT}/$1; # NON-S3
|
2022-07-19 23:31:28 +00:00
|
|
|
# Needed to ensure DSub auth isn't forwarded to S3/Minio, see #932.
|
|
|
|
# proxy_set_header Authorization ""; # S3
|
|
|
|
# proxy_pass $1; # S3
|
2018-06-19 08:13:34 +00:00
|
|
|
}
|
|
|
|
|
2022-04-26 16:03:09 +00:00
|
|
|
location /_protected/music/ {
|
2022-07-19 23:31:28 +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;
|
2022-07-09 15:11:20 +00:00
|
|
|
alias ${MUSIC_DIRECTORY_PATH}/;
|
2018-04-21 17:30:55 +00:00
|
|
|
}
|
|
|
|
|
2017-06-25 21:02:36 +00:00
|
|
|
location /staticfiles/ {
|
2022-07-19 23:31:28 +00:00
|
|
|
# Django static files
|
2018-08-31 17:21:46 +00:00
|
|
|
alias ${STATIC_ROOT}/;
|
2017-06-25 21:02:36 +00:00
|
|
|
}
|
|
|
|
}
|