After much research and option weighing, I have come to the conclusion that I will be using Apache + PHP fgci behind Nginx. Now, before everyone gets into an uproar as to why I just didn't opt all for Nginx, I'll explain why:
- Running Apache behind Nginx will allow me to retain mod_rewrite capabilities, so that I don't have to deal with rewriting the rules specifically for Nginx.
- Using Apache + PHP fcgi over mod_php was decided because of the lower memory footprint which is vital is pretty much any server environment. Using fcgi does have its downsides though; I will be unable to set PHP directives from the htaccess file as I have grown used to over the years. This means that I will have to come up with a PHP configuration that kicks butt and works well for my combination of mostly WordPress and Drupal powered sites.
- Much faster page load times; duh!
- Applications will see that they are being run from Apache, which is good because some web apps might disable certain functions if they detect they are being run on different server software.
Now, onto the database layer in that juicy web stack. I will being running Percona just because I have yet to see an argument yet about why I shouldn't run it. In the WHT forums, a guy said that I probably will not notice the difference between Percona and MySQL for the size of my server. Keeping in mind that memory is king, I wanted something like Nginx that could handle connections consistently even when put under a lot of stress. It is possible to optimize MySQL to use less memory by more or less following the "my-small" config to reduce the memory footprint and such. However, this does not address the issue that the InnoDB storage engine simply cannot handle as many transactions as the XtraDB engine can.
OK, so the big stuff is out of the way now but there are still more things I can do to optimize my setup. First thing is some sort of caching mechanism. While I haven't looked into caching and Nginx I do have experience with Apache, PHP, and XCache and let me tell you, XCache is truly amazing. For those of you who don't know, XCache is a PHP opcode cacher made by the same folks who make lighttpd. I never really thought much of of XCache until I installed it on my buddy's server and let me just share some of the statistics:
- 480.07Kb file reduced to 69.63Kb
- 30.70Kb file reduced to 3.03Kb
- 5.35Kb file reduced to 637.00b (that's bytes folks)
The second step you can take to speed up your server is CloudFlare which you can easily opt into here at MDDHosting through your CPanel (w00t!). Not only does it do an awesome job at caching files but it also functions as your DNS server which is just another load off of your machine. There's not much to say about CloudFlare except to just use it!
Sorry about the writing slowly turning to crap from top to bottom (quite tired as I write this) but hopefully, you get my general gist. Hopefully, I'll get this thing running on a sandbox server in the next few days and present even more findings! Also, I'll be running Ubuntu server 11.10 (the latest) with dropbear for the SSH server as it uses less memory than OpenSSH. Yay less memory usage!