Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sort of an odd question but should be pretty easy to solve. I am developing a Django website right now and the client wants a Wordpress blog as well. Because we're under the gun and have other projects as well, we don't have time to build a nice django blog so we're giving them Wordpress in a subfolder.

I have a lot of experience using Nginx but have never done something like this before, and I'm not very talented with regex.

Here's the structure:

blog (the wordpress blog)
static (all my static media, htdocs directory)

It's super lightweight thus far, only one single app (contact application). I want domain/blog to hit the /blog/ folder and treat static media like static media, and php files like php files proxying them to my fastcgi process.

And of course I want everything else to work with Django, going to my python fastcgi process.

For the record, everything is working properly except for this nginx config. All my fcgi processes are fine. Here is my nginx config:

# David Simons Website
server {
    listen       80;
    server_name  ********;

    root /usr/local/simons/static;

    index index.html index.php;

    location / {
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_pass_header Authorization;
        fastcgi_intercept_errors off;

    location ^~ /static/ {
        alias /usr/local/simons/static/;

    location ^~ /blog/ {
        root /usr/local/simons/;

    location ~* \.php$ {
       include /etc/nginx/fastcgi.conf;
       fastcgi_param  SCRIPT_FILENAME  /usr/local/simons/$fastcgi_script_name;

    location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
        access_log  off;
        expires 30d;

share|improve this question

Why don't you just do

location /blog {
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.