Apr 27 2009
Recent headlines have taught us that we pay a price for the accessibility provided with all of the ‘cloud computing’ services we enjoy. Problems like data theft, loss or uncontrolled downtime haunt even the best of services like Gmail.
So, in this first step of cloud control we’ll start taking back control of our data by unleashing the powerful server capabilities built right in to OS X.
Fire up the Stack
To set our Macs up as remote devices, we need a couple components. We need a web server to make our Mac available remotely. We’ll need a scripting language that supports many off-the-shelf applications we can download: PHP. We’ll also need a database to house the data we are going to create with these applications: MySQL.
You can get all three in nicely packaged ‘stacks’. XAMPP and MAMP are great choices for a quick install. However, they are both a little overweight in terms of what we need, and neither support an SSL connection out of the box.
So I chose a lesser-know alternative, Apprellium’s Abyss Web Server. It is easy to configure (right in your browser), lightweight: 3.9 MB and supports SSL so we can encrypt out transactions.
Since Abyss does not come in a stack, we’ll have to add PHP and MySQL ourselves, but that’s not hard. PHP is easily added using a pre-configured installer from Apprellium. The link also gives you the short-and-sweet configuration instructions.
For MySQL I chose a slightly older version packaged by Server Logistics for its small size. It comes with a preference pane for basic maintenance. Set your root password and we’re ready for the next step.
Now were ready to add PHP scripts and build applications we can use locally or remotely. In the next segment we’ll look at more open source applications you can use to enhance the function of your new server. For now, we’re going to install a couple that will make our databases more accessible.
phpMyAdmin is the most popular web-based tool for managing MySQL databases. Once installed, we’ll be able to build databases, upload data and generate reports using queries without writing a line of code. And, since we’ll be turning our Mac loose in cyberspace, this data will be accessible anywhere.
While phpMyAdmin is a great database management tool, I chose TurboDBAdmin for everyday data entry for my databases. Turbo sports a streamlined, AJAX interface that makes entering new data or editing existing data easy and fast.
Putting it all Together
With all these pieces in place we’re ready to open our server up for remote connections. If your Mac lives on an internal network, you’ll need to set up port forwarding from your router to your Mac and assign it a static internal IP. With your http ports opened on your firewall, you should now be able to see your web server by browsing to the IP address your ISP assigns. You may want to set up a free account with DynDNS and use their free dynamic DNS service to create a name that points to your IP for easier remote access.
A Word on Security
Allowing remote access to your Mac exposes it to risk. Fortunately, Abyss supports directory level access control, and you should set up a password to protect you sensitive directories and PHP scripts (password protecting phpMyAdmin is an absolute MUST). You could also create a non-root user in MySQL and use that in your PHP applications for added security. Only forward ports you are using, that are relatively safe (http rather than remote login or FTP) and configured.
The Fun is Just Beginning
Getting a working web server running on your Mac is a reward itself, but with PHP and MySQL in place and remote access working the possibilities are wide open. Check back for our part two of the series for some PHP/MySQL applications for managing your data and making the most of your new personal server.