Created
November 27, 2011 20:20
-
-
Save rfay/1398086 to your computer and use it in GitHub Desktop.
My nginx rewrite
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|bigsony|b)$; | |
#gzip off; | |
root /home/rfay/workspace/$domain; | |
fastcgi_read_timeout 1200; | |
fastcgi_send_timeout 1200; | |
client_max_body_size 128m; | |
rewrite_log on; | |
allow all; | |
location ~ \..*/.*\.php$ { | |
return 403; | |
} | |
#location /checkout/ { | |
#try_files $uri $uri/ @checkout_rewrite; | |
#} | |
#location /site_under_test/ { | |
#try_files $uri $uri/ @site_under_test_rewrite; | |
#} | |
location / { | |
# index index.php | |
try_files $uri @rewrite; | |
} | |
#location ^~ /xhprof_html/ { | |
#try_files $uri @xhprof_rewrite; | |
#} | |
location @checkout_rewrite { | |
# Some modules enforce no slash (/) at the end of the URL | |
# Else this rewrite block wouldn't be needed (GlobalRedirect) | |
#rewrite ^/checkout/install.php /checkout/core/install.php; | |
rewrite ^/checkout/(.*)$ /checkout/index.php?q=$1; | |
} | |
location @xhprof_rewrite { | |
rewrite ~/xhprof_rewrite/\?(.*)$ /xhprof/index.php?$1; | |
} | |
location @site_under_test_rewrite { | |
# Some modules enforce no slash (/) at the end of the URL | |
# Else this rewrite block wouldn't be needed (GlobalRedirect) | |
#rewrite ^/checkout/install.php /checkout/core/install.php; | |
rewrite ^/site_under_test/(.*)$ /site_under_test/index.php?q=$1; | |
} | |
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 localhost:9000; | |
} | |
# Fighting with ImageCache? This little gem is amazing. | |
location ~ ^/sites/.*/files/(styles|imagecache)/ { | |
try_files $uri @rewrite; | |
} | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires max; | |
log_not_found off; | |
} | |
} | |
server { | |
listen 443; | |
ssl on; | |
ssl_certificate /etc/nginx/server.crt; | |
ssl_certificate_key /etc/nginx/server.key; | |
ssl_session_timeout 5m; | |
#ssl_protocols SSLv2 SSLv3 TLSv1; | |
#ssl_prefer_server_ciphers on; | |
#ssl_session_cache shared:SSL:1m; | |
#ssl_ciphers SSLv2:-LOW:-EXPORT:RC4+RSA; | |
#server_name ~^($<domain>.*)\.l\/.*$; | |
server_name ~^(www\.)?(?<domain>.+)\.(l|bigsony|b)$; | |
#gzip off; | |
root /home/rfay/workspace/$domain; | |
fastcgi_read_timeout 1200; | |
fastcgi_send_timeout 1200; | |
client_max_body_size 128m; | |
rewrite_log on; | |
allow all; | |
location ~ \..*/.*\.php$ { | |
return 403; | |
} | |
location /checkout/ { | |
try_files $uri @checkout_rewrite; | |
} | |
#location /site_under_test/ { | |
#try_files $uri @site_under_test_rewrite; | |
#} | |
location / { | |
# This is cool because no php is touched for static content | |
try_files $uri @rewrite; | |
} | |
location @checkout_rewrite { | |
# Some modules enforce no slash (/) at the end of the URL | |
# Else this rewrite block wouldn't be needed (GlobalRedirect) | |
#rewrite ^/checkout/install.php /checkout/core/install.php; | |
rewrite ^/checkout/(.*)$ /checkout/index.php?q=$1; | |
} | |
location @site_under_test_rewrite { | |
# Some modules enforce no slash (/) at the end of the URL | |
# Else this rewrite block wouldn't be needed (GlobalRedirect) | |
#rewrite ^/checkout/install.php /checkout/core/install.php; | |
rewrite ^/site_under_test/(.*)$ /site_under_test/index.php?q=$1; | |
} | |
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 localhost:9000; | |
} | |
# Fighting with ImageCache? This little gem is amazing. | |
location ~ ^/sites/.*/files/(styles|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