Enhancements to the nginx configuration

Implementations for most of the open issues in the issue tracker. These changes are all in use on various production servers that I administer and have been very well tested for months. I also added a few new features that we are using on our servers, which I am sure will come in very handy for most people. Code review should be simple since I've limited things to one feature per commit. Enjoy!