From Hexwiki

This guide covers a robust LEMP (Linux, Nginx, MySQL, PHP) stack running on Debian Wheezy, which includes a similarly robust Dovecot + Postfix mail solution. You might not need everything here, but if you use Linux to serve the Internet in any fashion, you will probably find something of use in here.

After finally getting around to putting this up, I noticed I skipped over some documentation, and as a result I am probably still missing a few things. More than that, I am sure not all of this is very clear. Some of it may be wrong, or at least, 'improper'. It does work - you are reading this, after all - and it works quite smoothly.

I could add a few more items to the stack section - this server also runs Murmur (mumble-server), a git repository, several Minecraft servers, and a number of forums, blogs, and wikis. Most CMS platforms like the latter will get independent guides.

So, given that...

If there is something you want to setup that you would like me to add. If there is something confusing about the instructions, or I have missed a step. If I am doing something incorrectly. Or any other suggestion

Please feel free to e-mail me or sign up to the forums and let me know.

History of this guide

Back in 2009, my main forum (Elliquiy) had gone from outgrowing its shared hosting, to outgrowing its vps, which was then running Debian Etch. I got a Core2 Duo server with 4GB of RAM, installed Debian Lenny on it, and went about documenting everything that I had done. I published the result to my forums as 'The Elliquiy LAMP Stack'.

There were some problems with this.

1) Elliquiy has the 'distinction' of likely being the only site where this XKCD strip applied to the joke. That is, it's not safe for work, and https is forced. At least my e-mail was unaffected. And yes, by the time that strip was up I was already patched.

2) Even ignoring that it is five years old, it was still my first non-virtual Debian stack open to the Internet. The traffic that nearly brought it down would not even reach average these days.

A few servers and who knows how many VPSes later, I updated the documentation when I moved to Squeeze, but for various reasons, never got around to publishing it.

A few more servers and dropping my last VPS later, I updated the documentation to Wheezy. The following, with some server/purpose specific modifications, is currently running on three servers, two servers are at HostVenom in Chicago, the third server is at Hivelocity in Tampa. These two installations exchange their backups with each other every morning.

Hardware and Hosting

If you need it, I put up some quick advice on Choosing a Registrar and Choosing a Host.

Linux Core

The following assumes you have Wheezy installed and partitioned to your specifications - either by your host or by yourself via a remote KVM as above.

Software Stack

Unbound (1.4) - While I use a DNS service for my authoritative DNS servers, having a local DNS server is extremely handy. In addition to being almost a requirement for any mailserver that accepts mail, it can speed up some website functions immensely. MySQL (5.5) - Getting the database going early is often a priority. Nginx (1.2) - Webserver of champions. I do have some older documentation for Apache, but at this point I cannot afford to consider switching back. If using DotDeb, this documentation works fine for 1.4/1.6, it just doesn't take advantage of all features. I am holding off a bit on SPDY, personally. PHP (5.4) - FPM and the ancient fastcgi method are covered.

Mail Setup and Stack