Instantly share code, notes, and snippets.

Embed
What would you like to do?
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