- You'll never get great performance from shared hosting
- I've gained confidence in my own ability to devops
- I'm trying to improve my skill set
- It's actually cheaper; $7/mo for Hostgator shared hosting vs. $5/mo for Digital Ocean
- It's fun! (I need to get out more.)
My first reaction?
Not even kidding. It was literally as fun as flying an alien spaceship out of a secret government facility with Jeff Goldblum. Why?
Simply put: I can do cool stuff now. Varnish. Memcached. New Relic. Control my own environment, including resources and firewall. If I want I can double my resources for $10/mo, but I won't need to. I'm hosting 8 websites off a single server, and every single one of them screams. Here's a quote from an actual client:
IT’S FANTASTIC! You’re right; much, much faster. In fact, instant!!!!! THANK YOU!
How to Set Up Mail Forwarding on a VPS
First, what this isn't: This isn't a full-fledged mail server. No POP3, no IMAP. No local storage of emails. No spam filtering, no antivirus. All my forwards are going to gmail, which already has excellent spam filtering and antivirus. Maybe one day when I'm bored I'll add these things, but honestly at this point I'm afraid to sneeze at the server. This feeling will pass. Give me 24 hours and I'm sure I'll be messing with it in ways that would make Marilyn Manson say "dude, tone it down."
This is a mail forwarder. It's also an SMTP server; I can send emails from my virtual domains, eg. email@example.com. The trick is making sure the spammers don't get in; I made that mistake back in 2003, when I was running an IIS server out of my apartment. Good times.
OK, so how did I stumble into success?
Read this excellent tutorial from Digital Ocean. Turns out Digital Ocean is really cool like that. They don't just hand you the keys to the porsche (although they do that); they also hand you a map and driving directions to the nearest gas station and the freeway. In this case, they had a tutorial for the specific operating system I was using.
Short version: install the daemon using apt-get. Edit the text-only configuration file. Restart the daemon.
Add virtual aliases
Turns out it doesn't matter if you've already edited your MX records to point to Google Apps. The mail request still goes through postfix first. So you need a "virtual" file where you list your aliases. Eg. firstname.lastname@example.org forwards to email@example.com.
Tip: You have to load your "virtual" file into postfix after you edit, and then restart the postfix daemon again.
You have to add an authentication engine. No, really. There's a sasl_passwd file, but that's not enough. You have linux accounts, but that's not enough either. You need a separate engine to handle the actual smtp sasl authentication. Starting to sound like gibberish? That's ok, I don't really know what any of this means, I just know that when I followed a few tutorials and banged at it for a few hours, it ended up working.
Anyway, yeah. You need Dovecot.
It wasn't really that bad. If i had to do it again, I could do it pretty quickly and easily using these tutorials:
The painful part was the trial and error, setting up something I knew nothing about, and which was a dubious idea in the first place. But it worked, and I'm going to bed.