Skip to content

Instantly share code, notes, and snippets.

@toddsby
Forked from bastianallgeier/nginx
Last active August 29, 2015 14:17
Show Gist options
  • Save toddsby/c94ae6f1aae6ed5d62a2 to your computer and use it in GitHub Desktop.
Save toddsby/c94ae6f1aae6ed5d62a2 to your computer and use it in GitHub Desktop.
# block content
location ~ ^/content/(.*).(txt|md|mdown)$ {
rewrite ^/content/(.*).(txt|md|mdown)$ /error redirect;
}
# block all files in the site folder from being accessed directly
location ~ ^/site/(.*)$ {
rewrite ^/site/(.*)$ /error redirect;
}
# block all files in the kirby folder
location ~ ^/kirby/(.*)$ {
rewrite ^/kirby/(.*)$ /error redirect;
}
# site links
location / {
try_files $uri $uri/ /index.php?$uri&$args;
}
# panel links
location /panel {
try_files $uri $uri/ /panel/index.php?$uri&$args;
}
# deny access to .htaccess files
location ~ /\.ht {
deny all;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment