Created
February 10, 2012 09:49
-
-
Save markahesketh/1788149 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rewrite from example.com to www.example.com | |
server { | |
listen 80; | |
server_name example.com; | |
rewrite ^(.+?)/?$ http://www.example.com$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name www.example.com; | |
access_log /var/www/example.com/logs/access.log; | |
error_log /var/www/example.com/logs/error.log; | |
root /var/www/example.com/public_html; | |
location / { | |
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; | |
## Add trailing slash | |
rewrite ^(.*[^/])$ $1/ permanent; | |
### MAIN REWRITE - This will ignore directories | |
if (!-d $request_filename) { | |
rewrite ^/(.*)$ /index.php?symphony-page=$1 last; | |
} | |
} | |
location ~ \.php { | |
try_files $uri =404; | |
include /etc/nginx/fastcgi_params; | |
fastcgi_pass 127.0.0.1:9000; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME /var/www/example.com/public_html$fastcgi_script_name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment