From 8cff1cf999b7fa3964d14706d6a096c87a143b6c Mon Sep 17 00:00:00 2001 From: driz <40674481+drizuid@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:16:21 -0500 Subject: [PATCH 1/6] maybe fix nextcloud? --- root/defaults/nginx/site-confs/default.conf.sample | 11 +++-------- root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run | 5 +++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index f14518d..612595b 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -58,6 +58,9 @@ server { # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; + # default nginx mime.types + include mime.types; + # Specify how to handle directories -- specifying `/index.php$request_uri` # here as the fallback means that Nginx always exhibits the desired behaviour # when a client requests a path that corresponds to a directory that exists @@ -143,14 +146,6 @@ server { default_type application/wasm; } - location ~ \.js$ { - default_type text/javascript; - } - - location ~ \.mjs$ { - default_type text/javascript; - } - } location ~ \.woff2?$ { diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index aaae05b..fa3e299 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -168,3 +168,8 @@ if [ ! -s /config/www/nextcloud/config/config.php ]; then elif [ -f /config/www/nextcloud/config/config.php ]; then sed -i "s|/app/www/public/data|/data|g" /config/www/nextcloud/config/config.php fi + +#modify javascript mime type and add .mjs support +if [ ! -s /etc/nginx/mime.types ]; then + sed -i "|application/javascript js;|text/javascript js mjs;|g" /etc/nginx/mime.types +fi \ No newline at end of file From 2d7a5594b78372bbc5af4b01ebc4548adfe6274e Mon Sep 17 00:00:00 2001 From: driz <40674481+drizuid@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:46:11 -0500 Subject: [PATCH 2/6] fix typo --- root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index fa3e299..58651f9 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -171,5 +171,5 @@ fi #modify javascript mime type and add .mjs support if [ ! -s /etc/nginx/mime.types ]; then - sed -i "|application/javascript js;|text/javascript js mjs;|g" /etc/nginx/mime.types + sed -i "s|application/javascript js;|text/javascript js mjs;|g" /etc/nginx/mime.types fi \ No newline at end of file From 760894a4fb334b4029c88b8e40bf85966b99471d Mon Sep 17 00:00:00 2001 From: driz <40674481+drizuid@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:46:33 -0500 Subject: [PATCH 3/6] update date --- root/defaults/nginx/site-confs/default.conf.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 612595b..4b03337 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -1,4 +1,4 @@ -## Version 2023/12/25 - Changelog: https://github.com/linuxserver/docker-nextcloud/commits/master/root/defaults/nginx/site-confs/default.conf.sample +## Version 2024/01/03 - Changelog: https://github.com/linuxserver/docker-nextcloud/commits/master/root/defaults/nginx/site-confs/default.conf.sample # Set the `immutable` cache control options only for assets with a cache busting `v` argument map $arg_v $asset_immutable { From 6b9d8e456a9030a01f43fa7aca7db7cb83f7a447 Mon Sep 17 00:00:00 2001 From: driz <40674481+drizuid@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:15:26 -0500 Subject: [PATCH 4/6] try again --- root/defaults/nginx/site-confs/default.conf.sample | 4 ++-- root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 4b03337..1205b6f 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -36,7 +36,7 @@ server { gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; - gzip_types application/atom+xml text/javascript application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml 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; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml 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; # Pagespeed is not supported by Nextcloud, so if your server is built # with the `ngx_pagespeed` module, uncomment this line to disable it. @@ -171,4 +171,4 @@ server { location ~ /\.ht { deny all; } -} +} \ No newline at end of file diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index 58651f9..d7cd90d 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -170,6 +170,6 @@ elif [ -f /config/www/nextcloud/config/config.php ]; then fi #modify javascript mime type and add .mjs support -if [ ! -s /etc/nginx/mime.types ]; then - sed -i "s|application/javascript js;|text/javascript js mjs;|g" /etc/nginx/mime.types -fi \ No newline at end of file +if [ -s /etc/nginx/mime.types ]; then + sed -i 's| js;|js mjs;|g' /etc/nginx/mime.types +fi From 4030be827853102c904c898015197f9583a2f5fb Mon Sep 17 00:00:00 2001 From: driz <40674481+drizuid@users.noreply.github.com> Date: Wed, 3 Jan 2024 13:41:56 -0500 Subject: [PATCH 5/6] swap application/javascript to text/javascript per rfc --- root/defaults/nginx/site-confs/default.conf.sample | 2 +- root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index 1205b6f..c3532c7 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -36,7 +36,7 @@ server { gzip_comp_level 4; gzip_min_length 256; gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; - gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml 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; + gzip_types application/atom+xml text/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/wasm application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml 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; # Pagespeed is not supported by Nextcloud, so if your server is built # with the `ngx_pagespeed` module, uncomment this line to disable it. diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index d7cd90d..c6b477b 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -172,4 +172,5 @@ fi #modify javascript mime type and add .mjs support if [ -s /etc/nginx/mime.types ]; then sed -i 's| js;|js mjs;|g' /etc/nginx/mime.types + sed -i 's|^application/javascript|text/javascript|g' /etc/nginx/mime.types fi From ca6cd4b47ecedde586350bba27124a174d9fb14c Mon Sep 17 00:00:00 2001 From: driz <40674481+drizuid@users.noreply.github.com> Date: Wed, 3 Jan 2024 15:49:22 -0500 Subject: [PATCH 6/6] fix sed and add whitespace --- root/defaults/nginx/site-confs/default.conf.sample | 5 +---- root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/root/defaults/nginx/site-confs/default.conf.sample b/root/defaults/nginx/site-confs/default.conf.sample index c3532c7..d036ea9 100644 --- a/root/defaults/nginx/site-confs/default.conf.sample +++ b/root/defaults/nginx/site-confs/default.conf.sample @@ -58,9 +58,6 @@ server { # Remove X-Powered-By, which is an information leak fastcgi_hide_header X-Powered-By; - # default nginx mime.types - include mime.types; - # Specify how to handle directories -- specifying `/index.php$request_uri` # here as the fallback means that Nginx always exhibits the desired behaviour # when a client requests a path that corresponds to a directory that exists @@ -171,4 +168,4 @@ server { location ~ /\.ht { deny all; } -} \ No newline at end of file +} diff --git a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run index c6b477b..ffe4249 100755 --- a/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run +++ b/root/etc/s6-overlay/s6-rc.d/init-nextcloud-config/run @@ -171,6 +171,6 @@ fi #modify javascript mime type and add .mjs support if [ -s /etc/nginx/mime.types ]; then - sed -i 's| js;|js mjs;|g' /etc/nginx/mime.types - sed -i 's|^application/javascript|text/javascript|g' /etc/nginx/mime.types + sed -i 's|\bjs;|js mjs;|g' /etc/nginx/mime.types + sed -i 's|\bapplication/javascript|text/javascript|g' /etc/nginx/mime.types fi