Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
#This shows how to integrate a WP blog into a Rails site, as an Nginx config. #I am leaving most of the RoR specific stuff out. #You probably have an upstream for your mongrels already upstream mongrel_NameOfSite { #Do not care what is in here. } upstream NameOfSite_blog { server blog.example.com:80; #This server doesn't need to be publicly accessible. Private IPs are fine, only Nginx will ever see it. } #Here we have your main server block. We're going to intercept all requests made to URLs starting #with /blog/ and redirect them to the WP-using PHP server (Apache or whatever) rather than sending #them to Mongrel. server { listen 80; server_name www.example.com; #Skipping a lot of your configuration location /blog { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_redirect false; gzip on; gzip_min_length 1100; gzip_buffers 4 8k; gzip_proxied any; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; if (!-f $request_filename) { rewrite ^/blog$ /; rewrite ^/blog/(.*)$ /$1; proxy_pass http://NameOfSite_blog; break; } } #You also have some proxy fun stuff for Rails, too. That doesn't change. location / { #No changes here! } }
This paste will be private.
From the Design Piracy series on my blog: