Skip to content

Instantly share code, notes, and snippets.

@steinkel
Created May 16, 2014 09:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save steinkel/a3618fb9fc767391d46c to your computer and use it in GitHub Desktop.
Save steinkel/a3618fb9fc767391d46c to your computer and use it in GitHub Desktop.
getsimple cms nginx config file
server {
listen 80; ## listen for ipv4; this line is default and implied
root /var/virtual/www
index index.php;
server_name example.com;
charset utf-8;
access_log off;
location / {
try_files $uri $uri/ /index.php?id=$uri&$args;
}
location ~* /admin/.*\.php$ {
try_files $uri /admin/index.php?id=$uri&$args;
include php.conf;
#auth_basic "Restricted"; ## optional httpassword protection for /admin
#auth_basic_user_file /var/virtual/.htpasswd;
}
location ~* \.php$ {
include php.conf;
try_files $uri =404;
#expires 2h;
}
location ~* \.(?:ico|js|gif|jpg|png)$ {
#expires 14d;
}
location ~* \.(htm|css|html)$ {
#expires 2d;
}
# this blocks direct access to the XML files (but sitemap.xml) - that hold all the data
location ~* \.xml$ { deny all; }
location ~* \.xml\.bak$ { deny all; }
location = /sitemap.xml { allow all; }
# this prevents hidden files (beginning with a period) from being served
location ~ /\. { deny all; }
location ^~ /uploads/ {
if ($request_uri ~* \.php$) {return 403;}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment