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
|
|
|
if (!-e $request_filename)
|
|
|
|
{
|
2018-09-03 23:31:52 +02:00
|
|
|
rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
|
2017-03-02 15:49:44 +01:00
|
|
|
}
|
|
|
|
if ($scheme = http) {
|
|
|
|
rewrite ^ https://$server_name$request_uri? permanent;
|
|
|
|
}
|
|
|
|
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
|
|
|
|
add_header Strict-Transport-Security "max-age=15768000;";
|
|
|
|
add_header X-Content-Type-Options nosniff;
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
|
|
add_header X-Robots-Tag none;
|
|
|
|
add_header X-Download-Options noopen;
|
|
|
|
add_header X-Permitted-Cross-Domain-Policies none;
|
2015-11-11 18:03:16 +01:00
|
|
|
|
2017-03-02 15:49:44 +01:00
|
|
|
location ~* \.(jpg|jpeg|gif|css|png|js|ico|swf|mp3|pdf)$ {
|
|
|
|
# Le contenu statique, est signalé au navigateur comme étant
|
|
|
|
# à garder en cache une semaine. Si il y a un proxy sur la
|
|
|
|
# route, celui-ci est autorisé à faire une copie et à la
|
|
|
|
# cacher.
|
|
|
|
expires 1w;
|
|
|
|
add_header Cache-Control public;
|
|
|
|
}
|
|
|
|
location ~ [^/]\.php(/|$) {
|
|
|
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
2018-09-03 23:31:52 +02:00
|
|
|
fastcgi_pass unix:/var/run/php/php7.0-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
|
|
|
|
2017-03-02 15:49:44 +01: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
|
|
|
}
|