1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/matomo_ynh.git synced 2024-09-03 19:45:56 +02:00

Update nginx.conf

This commit is contained in:
ericgaspar 2021-05-17 23:39:12 +02:00
parent 98163604d4
commit 6ab1bf13aa
No known key found for this signature in database
GPG key ID: 574F281483054D44

View file

@ -1,20 +1,22 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location ^~ __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/ ; alias __FINALPATH__/;
# Force usage of https # Force usage of https
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
more_set_headers "Referrer-Policy: origin always";
more_set_headers "X-Content-Type-Options: nosniff";
more_set_headers "X-XSS-Protection: 1; mode=block";
index index.php; index index.php;
# Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file try_files $uri $uri/ =404;
client_max_body_size 100M;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
@ -26,18 +28,21 @@ location __PATH__/ {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
## deny access to all other .php files ## deny access to all other .php files
location ~* ^.+\.php$ { location ~* ^.+\.php$ {
deny all; deny all;
return 403; return 403;
} }
## disable all access to the following directories ## disable all access to the following directories
location ~ ^/(config|tmp|core|lang) { location ~ ^__PATH__/(config|tmp|core|lang) {
deny all; deny all;
return 403; # replace with 404 to not show these directories exist return 404;
}
location ~ __PATH__/\.ht {
deny all;
return 403;
} }
location ~ js/container_.*_preview\.js$ { location ~ js/container_.*_preview\.js$ {
@ -50,20 +55,20 @@ location __PATH__/ {
## Cache images,CSS,JS and webfonts for an hour ## Cache images,CSS,JS and webfonts for an hour
## Increasing the duration may improve the load-time, but may cause old files to show after an Matomo upgrade ## Increasing the duration may improve the load-time, but may cause old files to show after an Matomo upgrade
expires 1h; expires 1h;
more_set_headers "Cache-Control: public";
more_set_headers "Pragma: public"; more_set_headers "Pragma: public";
more_set_headers "Cache-Control: public";
} }
location __PATH__/(libs|vendor|plugins|misc|node_modules) { location ~ ^__PATH__/(libs|vendor|plugins|misc|node_modules) {
deny all; deny all;
return 403; return 403;
} }
## properly display textfiles in root directory ## properly display textfiles in root directory
location ~/(.*\.md|LEGALNOTICE|LICENSE) { location ~__PATH__/(.*\.md|LEGALNOTICE|LICENSE) {
default_type text/plain; default_type text/plain;
} }
# Include SSOWAT user panel. # show YunoHost panel access
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }