Skip to content

Commit

Permalink
add grav snippet for nginx
Browse files Browse the repository at this point in the history
  • Loading branch information
Soifou committed Nov 23, 2017
1 parent 8222b16 commit aa29c23
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions nginx/snippets/grav.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
index index.php index.html

## Begin - Index
# for subfolders, simply adjust:
# `location /subfolder {`
# and the rewrite to use `/subfolder/index.php`
location / {
try_files $uri $uri/ /index.php?_url=$uri&$query_string;
}
## End - Index

## Begin - Security
# deny all direct access for these folders
location ~* /(\.git|cache|bin|logs|backup|tests)/.*$ { return 403; }
# deny running scripts inside core system folders
location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
# deny running scripts inside user folder
location ~* /user/.*\.(txt|md|yaml|yml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
# deny access to specific files in the root folder
location ~ /(LICENSE\.txt|composer\.lock|composer\.json|nginx\.conf|web\.config|htaccess\.txt|\.htaccess) { return 403; }
## End - Security

location ~ \.php$ {
fastcgi_pass php:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}

0 comments on commit aa29c23

Please sign in to comment.