Hacker News new | ask | show | jobs
by sr3d 5798 days ago
I have the exact setup for Marrily.com: http://marrily.com/blog. The main site runs Rails 3RC, and any requests begin with /blog will get proxied over to the WordPress site running locally.

Basically I have Apache running on port 81 locally, and I setup the WordPress to a "blog" folder underneath the DocumentRoot.

Then within the server { } configure block in nginx, I have

server { # your server settings, like "listen 80;"

  location /blog {
    proxy_redirect off;
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #add_header X-Marrily-DEBUG "$Host";    # turn this on to test the header
    proxy_pass http://127.0.0.1:81;
  }
}

You will have to update the WordPress config to tell that it's installed in a sub folder and not at the root. It took me a while to figure out (all other articles online will tell you to update the wp-config.php file to define the different constants, but it's not the right spot for WordPress 3). You'd have to update the wp_options table as well to fix the path. Here's a screenshot: http://cl.ly/468cab133aca48eea173

Good luck!

(this post should go to StackOverflow, but since I just went through the exact same experience, I thought I'd share it)