chris (owner)

Revisions

gist: 8005 Download_button fork
public
Public Clone URL: git://gist.github.com/8005.git
Embed All Files: show embed
WordPress Nginx proxied subdirectory config file #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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;
  }
}