Created
March 16, 2011 04:39
-
-
Save rfay/872026 to your computer and use it in GitHub Desktop.
default for /etc/nginx/sites-available when using 0.8.54
This file contains hidden or 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
server { | |
listen 80; | |
#server_name ~^($<domain>.*)\.l\/.*$; | |
server_name ~^(www\.)?(?<domain>.+)\.l$; | |
root /home/rfay/workspace/$domain; | |
allow all; | |
# Very rarely should these ever be accessed outside of your lan | |
location ~* \.(txt|log)$ { | |
allow all; | |
} | |
location ~ \..*/.*\.php$ { | |
return 403; | |
} | |
location / { | |
# This is cool because no php is touched for static content | |
try_files $uri @rewrite; | |
#root /home/rfay/workspace/$domain; | |
} | |
location @rewrite { | |
# Some modules enforce no slash (/) at the end of the URL | |
# Else this rewrite block wouldn't be needed (GlobalRedirect) | |
rewrite ^/(.*)$ /index.php?q=$1; | |
} | |
location ~ \.php$ { | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_intercept_errors on; | |
fastcgi_pass unix:/tmp/php.socket; | |
} | |
# Fighting with ImageCache? This little gem is amazing. | |
location ~ ^/sites/.*/files/imagecache/ { | |
try_files $uri @rewrite; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment