1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/funkwhale_ynh.git synced 2024-09-03 18:36:24 +02:00

fix nginx

This commit is contained in:
Thomas 2023-12-13 19:51:14 +01:00 committed by GitHub
parent 07a3bb7bcf
commit bdd2baf3ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,10 @@
# HSTS # HSTS
add_header Strict-Transport-Security "max-age=31536000"; more_set_headers Strict-Transport-Security "max-age=31536000";
# General configs # General configs
root ${FUNKWHALE_FRONTEND_PATH}; root __INSTALL_DIR__/front/dist;
client_max_body_size ${NGINX_MAX_BODY_SIZE}; client_max_body_size 100M;
charset utf-8; charset utf-8;
# compression settings # compression settings
@ -34,15 +34,15 @@
# end of compression settings # end of compression settings
# headers # headers
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'"; more_set_headers 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'";
add_header Referrer-Policy "strict-origin-when-cross-origin"; more_set_headers Referrer-Policy "strict-origin-when-cross-origin";
add_header X-Frame-Options "SAMEORIGIN" always; more_set_headers X-Frame-Options "SAMEORIGIN" always;
add_header Service-Worker-Allowed "/"; more_set_headers Service-Worker-Allowed "/";
location /api/ { location /api/ {
include /etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf; include /etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf;
# This is needed if you have file import via upload enabled. # This is needed if you have file import via upload enabled.
client_max_body_size ${NGINX_MAX_BODY_SIZE}; client_max_body_size 100M;
proxy_pass http://127.0.0.1:__PORT__; proxy_pass http://127.0.0.1:__PORT__;
} }
@ -58,7 +58,7 @@
location ~ ^/@(vite-plugin-pwa|vite|id)/ { location ~ ^/@(vite-plugin-pwa|vite|id)/ {
include /etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf; include /etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf;
alias ${FUNKWHALE_FRONTEND_PATH}/; alias __INSTALL_DIR__/front/dist/;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
@ -70,14 +70,14 @@
location / { location / {
expires 1d; expires 1d;
include /etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf; include /etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf;
alias ${FUNKWHALE_FRONTEND_PATH}/; alias __INSTALL_DIR__/front/dist/;
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
location ~ "/(front/)?embed.html" { location ~ "/(front/)?embed.html" {
alias ${FUNKWHALE_FRONTEND_PATH}/embed.html; alias __INSTALL_DIR__/front/dist/;embed.html;
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:"; more_set_headers 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:";
add_header Referrer-Policy "strict-origin-when-cross-origin"; more_set_headers Referrer-Policy "strict-origin-when-cross-origin";
expires 1d; expires 1d;
} }
@ -100,20 +100,20 @@
# Allow direct access to only specific subdirectories in /media # Allow direct access to only specific subdirectories in /media
location /media/__sized__/ { location /media/__sized__/ {
alias ${MEDIA_ROOT}/__sized__/; alias __DATA_DIR__/data/media/__sized__/;
add_header Access-Control-Allow-Origin '*'; more_set_headers "Access-Control-Allow-Origin: *";
} }
# Allow direct access to only specific subdirectories in /media # Allow direct access to only specific subdirectories in /media
location /media/attachments/ { location /media/attachments/ {
alias ${MEDIA_ROOT}/attachments/; alias __DATA_DIR__/data/media/attachments/;
add_header Access-Control-Allow-Origin '*'; more_set_headers "Access-Control-Allow-Origin: *";
} }
# Allow direct access to only specific subdirectories in /media # Allow direct access to only specific subdirectories in /media
location /media/dynamic_preferences/ { location /media/dynamic_preferences/ {
alias ${MEDIA_ROOT}/dynamic_preferences/; alias __DATA_DIR__/data/media/dynamic_preferences/;
add_header Access-Control-Allow-Origin '*'; more_set_headers "Access-Control-Allow-Origin: *";
} }
# This is an internal location that is used to serve # This is an internal location that is used to serve
@ -123,11 +123,11 @@
# if you're storing media files in a S3 bucket. # if you're storing media files in a S3 bucket.
location ~ /_protected/media/(.+) { location ~ /_protected/media/(.+) {
internal; internal;
alias ${MEDIA_ROOT}/$1; # NON-S3 alias __DATA_DIR__/data/media/$1; # NON-S3
# Needed to ensure DSub auth isn't forwarded to S3/Minio, see #932. # Needed to ensure DSub auth isn't forwarded to S3/Minio, see #932.
# proxy_set_header Authorization ""; # S3 # proxy_set_header Authorization ""; # S3
# proxy_pass $1; # S3 # proxy_pass $1; # S3
add_header Access-Control-Allow-Origin '*'; more_set_headers "Access-Control-Allow-Origin: *";
} }
location /_protected/music/ { location /_protected/music/ {
@ -136,15 +136,15 @@
# has been checked on API side. # has been checked on API side.
# Set this to the same value as your MUSIC_DIRECTORY_PATH setting. # Set this to the same value as your MUSIC_DIRECTORY_PATH setting.
internal; internal;
alias ${MUSIC_DIRECTORY_PATH}/; alias __DATA_DIR__/data/music/;
add_header Access-Control-Allow-Origin '*'; more_set_headers "Access-Control-Allow-Origin: *";
} }
location /manifest.json { location /manifest.json {
# If the reverse proxy is terminating SSL, nginx gets confused and redirects to http, hence the full URL # If the reverse proxy is terminating SSL, nginx gets confused and redirects to http, hence the full URL
return 302 ${FUNKWHALE_PROTOCOL}://${FUNKWHALE_HOSTNAME}/api/v1/instance/spa-manifest.json; return 302 https://__DOMAIN__/api/v1/instance/spa-manifest.json;
} }
location /staticfiles/ { location /staticfiles/ {
alias ${STATIC_ROOT}/; alias __DATA_DIR__/data/static/;
} }