This update was in the works for a couple of weeks now, but just a couple of minutes ago I finally pulled the switch, and switched my webserver over to nginx as a reverse proxy for Apache. Nginx can serve up static content faster than you can blink, so that is why it is the first responder to all web requests on 80 and 443. I have a regex line that looks for static content and tells nginx to deliver it without hitting Apache. If the request does not match this regex it will simply be forwarded to Apache to handle it like a normal request.

This update has allowed me to move my webserver from a physical host with 8GB of ram and 2 Intel Xeon processors to a Virtual Machine with only 2 virt cores and 2GB of ram. Putting my server under a stress test I see that I can’t max out the 2 cores, or get the ram to go above 500mb, whereas with the old machine I could max out all 4 cores and get the ram up to 4-5GB’s used.

Static Content Regex

location ~* ^.+\.(png|jpeg|jpg|gif|css|js|ico|txt|swf|zip|rar|html|htm|pdf|flv|mov|mp3|m4a|woff|eoff)$