1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/spip_ynh.git synced 2024-09-03 20:25:59 +02:00

rewrite dans la conf de nginx

This commit is contained in:
magikcypress 2017-02-23 02:07:28 +01:00
parent ff728e3183
commit d55178d4fe
2 changed files with 16 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<?php <?php
# Pour simuler une redirection Apache # Pour simuler une redirection Apache
define('_SERVER_APACHE', 'false'); define('_SERVER_APACHE', 'false');
define('_DIR_CONNECT', 'config'); // define('_DIR_CONNECT', 'config');
define('_DIR_TMP', 'tmp'); // define('_DIR_TMP', 'tmp');

View file

@ -6,6 +6,7 @@
location __PATHTOCHANGE__ { location __PATHTOCHANGE__ {
alias __FINALPATH__/; alias __FINALPATH__/;
index index.php; index index.php;
if (!-e $request_filename) if (!-e $request_filename)
{ {
rewrite ^(.+)$ __PATHTOCHANGE__/index.php?q=$1 last; rewrite ^(.+)$ __PATHTOCHANGE__/index.php?q=$1 last;
@ -14,6 +15,16 @@ location __PATHTOCHANGE__ {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
client_max_body_size 30m; client_max_body_size 30m;
# 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;
location ~^/(tmp|config)/{ location ~^/(tmp|config)/{
return 403; return 403;
} }
@ -25,16 +36,16 @@ location __PATHTOCHANGE__ {
expires 1w; expires 1w;
add_header Cache-Control public; add_header Cache-Control public;
} }
location /__NAMETOCHANGE__ { location ~ ^/__NAMETOCHANGE__ {
# La configuration globale du site. Tout ce qui ne va dans # La configuration globale du site. Tout ce qui ne va dans
# aucune autre location vas ici. # aucune autre location vas ici.
# Quelques fichiers standards générés par spip et devant être # Quelques fichiers standards générés par spip et devant être
# à des URL précises. # à des URL précises.
rewrite ^/([^/]*)/robots\.txt$ /spip.php?page=robots.txt last; rewrite ^/([^/]*)/robots\.txt$ /spip.php?page=robots.txt last;
rewrite ^/([^/]*)/favicon\.ico$ /spip.php?page=favicon.ico last; rewrite ^/([^/]*)/favicon\.ico$ /spip.php?page=favicon.ico last;
rewrite ^/([^/]*)/sitemap\.xml$ /spip.php?page=sitemap.xml last; rewrite ^/([^/]*)/sitemap\.xml$ /spip.php?page=sitemap.xml last;
rewrite ^/([^/]*)/mobile\.html$ /spip.php?page=mobile_uk last; rewrite ^/([^/]*)/mobile\.html$ /spip.php?page=mobile_uk last;
try_files $uri $uri/ /spip.php?q=$uri&$args; try_files $uri $uri/ /spip.php?q=$uri&$args;
} }