Skip to content

Instantly share code, notes, and snippets.

@nickdunn
Forked from klaftertief/gist:259416
Created December 18, 2009 15:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nickdunn/259580 to your computer and use it in GitHub Desktop.
Save nickdunn/259580 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name localhost;
access_log /path/to/log/access.log;
error_log /path/to/log/error.log;
location / {
root /path/to/root;
index index.php;
# serve static files directly
if (-f $request_filename) {
access_log off;
expires 30d;
break;
}
### BACKEND
if ($request_filename ~ /symphony/) {
rewrite ^/symphony/?$ /index.php?mode=administration&$query_string last;
rewrite ^/symphony(/(.*/?))?$ /index.php?symphony-page=$1&mode=administration&$query_string last;
}
### IMAGE RULES
rewrite ^/image/(.+\.(jpg|gif|jpeg|png|bmp|JPG|GIF|JPEG|PNG|BMP))$ /extensions/jit_image_manipulation/lib/image.php?param=$1 last;
### CHECK FOR TRAILING SLASH - Will ignore files
if (!-f $request_filename) {
rewrite ^/(.*[^/]+)$ /$1/ permanent;
}
### MAIN REWRITE - This will ignore directories
if (!-d $request_filename) {
rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
}
}
location ~ \.php($|/) {
fastcgi_index index.php;
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.*)") {
set $script $1;
set $path_info $2;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/root$script;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_NAME $script;
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment