Last active
March 30, 2016 08:09
-
-
Save dgdsp/3b37b1132512171346d7 to your computer and use it in GitHub Desktop.
kirby-cms 2.2 nginx rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## kirby | |
# Don't hint these as folders | |
rewrite ^/(site|kirby|panel/app|panel/test)$ /error last; | |
# block content | |
location ~ /(assets|content|site|kirby|thumbs) { | |
rewrite ^/(.*).(txt|md|mdown|yaml|yml|svn.*|git.*)$ /error last; | |
} | |
# site links | |
location / { | |
try_files $uri $uri/ /index.php$is_args$args; | |
} | |
# panel links | |
location /panel { | |
if (!-f $request_filename){ | |
set $rule_0 1$rule_0; | |
} | |
if (!-d $request_filename){ | |
set $rule_0 2$rule_0; | |
} | |
if ($rule_0 = "21"){ | |
rewrite ^/panel/(.*) /panel/index.php last; | |
} | |
} | |
# Prevent clients from accessing hidden files (starting with a dot) | |
# This is particularly important if you store .htpasswd files in the site hierarchy | |
location ~ (?:^|/)\. { | |
deny all; | |
} | |
# Prevent clients from accessing to backup/config/source files | |
location ~ (?:\.(?:bak|config|ini|log|sh|inc|swp|dist)|~)$ { | |
deny all; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment