NGINX Revisited

written by amcvega on October 22nd, 2006 @ 11:09 PM

I promised that I would post my own setup of NGINX and I’m back to make good on that promise.

Now, a few disclaimers before we start. I’m no expert at setting up nginx…at least not yet ;-) My setup is on planet argon so I don’t have complete control over my deployment options. (You’ll notice that nginx listens over port 80xx and not port 80)

My nginx.conf redirects to 2 applications depending on the subdomain provided.

One of the things I originally had trouble before I got this setup working was the fact that nginx has a lot of temp files. I have no idea right now what a client_body_temp is used for but it needs it.

Unfortunately, the whole thing defaults to a directory I had no permission writing in which is why I had to specify each and every temp path nginx required. That was really the only thing that hampered my quick setup efforts. Once I got that done, everything just clicked.

For added performance bonus, I decided to let nginx handle all the static files in my public directory. To do this, I needed to add this little snippet: location ~ /(images|stylesheets|javascripts)/ { root /var/www/virtual/; }

This tells nginx to serve images, stylesheets, and javascripts itself without having to call my backend servers.

There are probably parts of this setup that I couldn’t fine-tuned to make it less repetetive. This setup works right now but I’ll probably tweak it some more after I learn more about this curiously quick webserver.

Post a comment