The all important user interface Nginx and File Upload Progress
Jun 12

The usual and perhaps recommended way to run wordpress behind nginx is via nginx and fast-cgi. You can easily find these articles on google. However, that’s quite a complex setup and it far easier to just run apache2 + php + wordpress behind nginx and use nginx as a proxy. It’s probably a waste of memory to run the monstrous apache along with nginx but it’s much simpler setup and between my time and computer memory, my time is far more expensive!

Just install wordpress following their usual instructions, then change the apache port to something other than 80 (since nginx is running on 80). Following example assumes apache running at 800.

Then, add following to your nginx conf:

server {
  listen   80;
  server_name  your.blogserver.com;
  location / {
    proxy_pass http://localhost:800;
    proxy_set_header Host $host;
  }
}

Restart your nginx and http://your.blogserver.com should now be your wordpress blog.

Pay special attention to proxy_set_header directive. It took me a while to figure out why wordpress was redirecting itself to ‘localhost’ !!!

Also, the apache config must have DirectoryIndex index.php set.

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • StumbleUpon
  • Propeller
  • Technorati

2 Responses to “Running wordpress behind nginx”

  1. KonstantinMiller Says:

    I have been looking looking around for this kind of information. Will you post some more in future? I’ll be grateful if you will.

  2. Ecolfpopelifs Says:

    Other variant is possible also

Leave a Reply

preload preload preload