Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chris/8005 to your computer and use it in GitHub Desktop.
Save chris/8005 to your computer and use it in GitHub Desktop.
# This is for a WordPress installed at /var/www/wordpress/blog, and accessed at http://www.example.com/blog.
server {
listen 80;
server_name blog.example.com;
root /var/www/wordpress;
index index.php;
access_log /var/log/nginx/blog.access.log;
error_log /var/log/nginx/blog.error.log notice;
location / {
root /var/www/wordpress;
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 /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:53345;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/wordpress$fastcgi_script_name;
root /var/www/wordpress;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment