Skip to content

Instantly share code, notes, and snippets.

@ozeias
Created January 15, 2009 17:01
Show Gist options
  • Save ozeias/47487 to your computer and use it in GitHub Desktop.
Save ozeias/47487 to your computer and use it in GitHub Desktop.
## railsbox.org:~ ozeias$ vim /usr/local/nginx/conf/vhosts/example.com.conf
# This is for a WordPress installed at /var/www/example.com/blog, and accessed at http://example.com
server {
listen 80;
server_name example.com;
root /var/www/example.com/blog;
index index.php;
access_log /usr/local/nginx/logs/example.com.access.log;
error_log /usr/local/nginx/logs/example.com.error.log notice;
location / {
root /var/www/example.com/blog;
index index.php;
# this serves static files that exist without running other rewrite tests
if (-f $request_filename) {
expires 30d;
break;
}
# this sends all non-existing file or directory requests to index.php
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
}
location ~ .php$ {
include /usr/local/nginx/conf/fastcgi_params.default;
if ( $uri !~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$) {
fastcgi_pass 127.0.0.1:9000;
}
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/example.com/blog$fastcgi_script_name;
root /var/www/example.com/blog;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment