2018-09-03 23:44:41 +02:00
|
|
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
|
|
|
location __PATH__/ {
|
2017-03-02 15:49:44 +01:00
|
|
|
alias __FINALPATH__/;
|
|
|
|
index index.php;
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2017-03-02 15:49:44 +01:00
|
|
|
client_max_body_size 30m;
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2017-03-02 15:49:44 +01:00
|
|
|
# Add headers to serve security related headers
|
2019-10-26 15:09:06 +02:00
|
|
|
more_set_headers "Strict-Transport-Security: max-age=15768000";
|
|
|
|
more_set_headers "X-Content-Type-Options: nosniff";
|
|
|
|
more_set_headers "X-Frame-Options: SAMEORIGIN";
|
|
|
|
more_set_headers "X-XSS-Protection: 1; mode=block";
|
|
|
|
more_set_headers "X-Download-Options: noopen";
|
|
|
|
more_set_headers "X-Permitted-Cross-Domain-Policies: none";
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2021-07-12 22:47:43 +02:00
|
|
|
# Bug in Nginx with locations and aliases (see http://stackoverflow.com/a/35102259 )
|
|
|
|
try_files $uri $uri/ __PATH__/__PATH__/index.php?$query_string;
|
|
|
|
|
|
|
|
location ~ \.php$ {
|
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
2020-07-10 19:22:37 +02:00
|
|
|
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
2017-03-02 15:49:44 +01:00
|
|
|
fastcgi_index index.php;
|
|
|
|
include fastcgi_params;
|
2018-09-03 23:44:41 +02:00
|
|
|
# https://learn.getgrav.org/webservers-hosting/servers/nginx#fix-against-httpoxy-vulnerability
|
|
|
|
fastcgi_param HTTP_PROXY "";
|
2017-03-02 15:49:44 +01:00
|
|
|
fastcgi_param REMOTE_USER $remote_user;
|
|
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
|
|
|
fastcgi_param SCRIPT_FILENAME $request_filename;
|
|
|
|
}
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2021-07-08 22:11:22 +02:00
|
|
|
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
|
|
|
|
expires 30d;
|
|
|
|
more_set_headers "Vary: Accept-Encoding";
|
|
|
|
log_not_found off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|woff2|svg)$ {
|
|
|
|
access_log off;
|
|
|
|
expires 30d;
|
|
|
|
more_set_headers "Cache-Control: public";
|
|
|
|
|
|
|
|
## No need to bleed constant updates. Send the all shebang in one fell swoop.
|
|
|
|
tcp_nodelay off;
|
|
|
|
|
|
|
|
## Set the OS file cache.
|
|
|
|
open_file_cache max=3000 inactive=120s;
|
|
|
|
open_file_cache_valid 45s;
|
|
|
|
open_file_cache_min_uses 2;
|
|
|
|
open_file_cache_errors off;
|
|
|
|
}
|
|
|
|
|
2020-07-10 19:22:37 +02:00
|
|
|
## Begin - Security
|
|
|
|
# deny all direct access for these folders
|
|
|
|
location ~* /(.git|cache|bin|logs|backups)/.*$ { return 403; }
|
|
|
|
# deny running scripts inside core system folders
|
|
|
|
location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
|
|
|
|
# deny running scripts inside user folder
|
|
|
|
location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
|
|
|
|
# deny access to specific files in the root folder
|
|
|
|
location ~ /(LICENSE|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
|
|
|
|
## End - Security
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2017-03-02 15:49:44 +01:00
|
|
|
#--PRIVATE--# Include SSOWAT user panel.
|
|
|
|
#--PRIVATE--include conf.d/yunohost_panel.conf.inc;
|
2015-11-11 18:03:16 +01:00
|
|
|
}
|