Skip to content

Instantly share code, notes, and snippets.

@sergeybe
Last active September 2, 2015 14:04
Show Gist options
  • Save sergeybe/49713d795b1395b1a423 to your computer and use it in GitHub Desktop.
Save sergeybe/49713d795b1395b1a423 to your computer and use it in GitHub Desktop.
Config for MODX CMS
index index.php;
client_max_body_size 30M;
if ($request_uri ~ " ") {
return 444;
}.
location / {
try_files $uri $uri/ @modx;
index index.php;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?q=$1 last;
}
}
location /core/ {
deny all;
}
location /setup/ {
deny all;
}
location /_build/ {
deny all;
}
location ~ \.php$ {
try_files $uri @modx;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
}
include fastcgi_params;
fastcgi_pass php-fpm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location @modx {
include fastcgi_params;
fastcgi_pass php-fpm;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING q=$request_uri;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
}
location ~ (/\.ht|\.hg|\.git) {
deny all;
}
location ~* ^.+\.(js|css|png|jpg|jpeg|gif|ico|bmp)$ {
access_log off;
expires 1h;
log_not_found off;
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment