Created
January 2, 2011 08:32
-
-
Save ninehills/762406 to your computer and use it in GitHub Desktop.
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 9hills.us; | |
access_log /var/log/nginx/9hills.us.access.log; | |
root /var/www/wordpress; | |
## Default location | |
location / { | |
index index.html index.php; | |
#WP Permalinks rewrite | |
rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last; | |
if (!-e $request_filename) { | |
rewrite ^.+?(/wp-.*) $1 last; | |
rewrite ^.+?(/.*\.php)$ $1 last; | |
rewrite ^ /index.php last; | |
} | |
#WP-super-cache rewrite | |
set $wp_super_cache_file ”; | |
set $wp_super_cache_uri $request_uri; | |
if ( $request_method = POST ) | |
{ | |
set $wp_super_cache_uri ”; | |
} | |
if ( $query_string ) | |
{ | |
set $wp_super_cache_uri ”; | |
} | |
if ( $http_cookie ~* “comment_author_|wordpress|wp-postpass_” ) | |
{ | |
set $wp_super_cache_uri ”; | |
} | |
if ( $wp_super_cache_uri ~ ^(.+)$ ) | |
{ | |
set $wp_super_cache_file /wp-content/cache/supercache/$http_host/$1index.html; | |
} | |
if ( -f $document_root$wp_super_cache_file ) | |
{ | |
rewrite ^(.*)$ $wp_super_cache_file break; | |
} | |
if (-f $request_filename) | |
{ | |
expires 30d; | |
break; | |
} | |
if (!-e $request_filename) | |
{ | |
rewrite ^(.+)$ /index.php?q=$1 last; | |
} | |
} | |
## Images and static content is treated different | |
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { | |
access_log off; | |
expires 30d; | |
break; | |
} | |
## Parse all .php file in the /var/www directory | |
location ~ .*\.php$ { | |
#fastcgi_split_path_info ^(.+\.php)(.*)$; | |
fastcgi_pass backend; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
fastcgi_intercept_errors on; | |
fastcgi_ignore_client_abort off; | |
fastcgi_connect_timeout 60; | |
fastcgi_send_timeout 180; | |
fastcgi_read_timeout 180; | |
fastcgi_buffer_size 128k; | |
fastcgi_buffers 4 256k; | |
fastcgi_busy_buffers_size 256k; | |
fastcgi_temp_file_write_size 256k; | |
} | |
## Disable viewing .htaccess & .htpassword | |
location ~ /\.ht { | |
deny all; | |
} | |
} | |
upstream backend { | |
server 127.0.0.1:9000; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment