If you’re not a computer nerd, buying web hosting can feel like buying a house. Or, worse, like buying a car. Or, even worse than that, a new computer.
It doesn’t have to be painful. In fact, most people who want a simple blog or website don’t even need to buy web hosting in the first place. And, this is the kicker, if you do end up buying web hosting, sooner or later you’ll realize that you’ve invested your whole identity, or your business, or whatever’s important to you, in a place that you don’t actually have any control over, and can’t easily leave. Backups will become important, but they’re gonna be a massive headache. You may find yourself hitting resource quotas, or your credit card will be charged for hidden and contract “renewal” fees or some such bullshit like that, none of which you were told about when you signed up. And, worst of all, you could find yourself digitally gagged, censored, or even outright banned just because someone else on the same “shared server” you were assigned was behaving badly.
Fuck. That. Shit. And, more to the point, why on God’s green Earth would you pay to be subjected to such bullshit?
With just a little bit of patience, enough computer know-how to understand how to click a few download links and move files from one folder to another, and a willingness to read this post, you can avoid every single one of those frustrating web host experiences, all while ending up with seamless, automatic backups of your entire blog, the ability to legally dodge shitty censorship and corporate contracts alike, and the ability to easily participate in the ever-expanding social media frenzy without spending hours managing all your different accounts manually. And did I mention it’s free?
I’m gonna show you how to make a website (a simple blog), for the low, low price of $01 that you fully control. A website that you can take with you everywhere you go. That even exists, in its entirety, on your own computer.
“All right, then, smarty pants,” I’m sure some of you are saying to yourselves. “Let’s see it then.”
Understand that companies are scammers
Recently, I helped a friend who wanted to make their own website decode the dizzying array of Web hosting options available to them. They had done some searching for a web host on their own and quickly felt disoriented by the mix of acronyms, various price points, service levels, so-called “unlimited” abuse agreements, and on and on they were confronted with. If you’ve ever tried to get clear answers from the front page of whatever Acme Web Hosting Incorporated you found yourself at, I’m sure you’ve had a similar experience.
Thankfully, it’s relatively easy to stay very much within “the (very biased against you anyway) terms of service” while pitting the ways different companies take advantage of you against one another. The result is kind of a steal. And I mean “steal” in that good way, like, you should steal things from the rich and from corporations if you can do so safely, and avoid all commercial extortion-ware and intimidating high-pressure sales pitches that leave you at the whim of some corporation that just wants to abuse you anyway.
You probably already have a “web host”; it’s your computer
If you have a computer of your own, like a laptop or a family computer, then you already have everything you need to have a website. You don’t technically need to pay anyone anything to make one for you. So why do so many people pay through the nose for it?
The thing you gotta understand, and the thing I kept having to explain to my friend, is that what a “Web hosting” company is doing is not really any different than what the very same computer you’re using to read this blog post or that we were using to browse web hosting company feature lists was already capable of doing. In fact, when you “buy web space” from a website hosting company, all you’re fundamentally doing is giving them money so that they’ll let you put some files (like your essays, or pictures, or what-have-you that you want to put online) on a computer that they promise to keep connected to the Internet at all times.
That’s all “web hosting” is: a computer, just like your laptop, but one that’s always connected to the Internet. Under the hood, most everything else is the same. They use the same operating system that you do, or at least one that’s for all intents and purposes indistinguishable from yours. They use the same software you probably already have installed, or at least have free access to. The only key difference is that they don’t shutdown their computer, and you often do.
You can, of course, never disconnect your computer from the ‘net. But that’s not feasible for a lot of folks who want to take their laptop to Starbucks on occasion, y’know? Moreover, the web hosting company’s connection to the Internet is very “wide,” while yours is “narrow.” That is to say, if your website is a house (and it kind of is), then your laptop’s door is, “physically” very small. Only a few people can walk through it to visit your cyber-house at a time. But the web hosting company’s door is very wide, so a lot of people can walk through all at the same time.2
Gee, that’d be a nice place for an indie rave
Since websites are fundamentally all the same, it turns out that a lot of companies that don’t call themselves “web hosting companies” have the same kind of “wide door that’s always connected to the Internet” the web host companies are offering to sell you. And those other companies let you use those wide doors and their always-connected-to-the-Internet cyber-houses for free. And you probably already know them by name: WordPress.com and Tumblr.com are two really famous examples.
So hey, how would we solve this problem if we weren’t doing it in cyberspace? Well, if all you have is a tiny dorm room, you ain’t gonna throw a party for 100 people in there, right? You’re gonna ask some friend who has a bigger pad to host the party for you. Or, y’know, you’d just storm a warehouse without asking. Since corporations are never our friends, we’re gonna do the latter: we’re gonna do all the partying at their place (mostly uninvited), but we’re gonna set the party up in our own place first.
Now, when you use someone else’s warehouse for a party mostly uninvited, it’s important to have an escape plan just in case the worst happens and they kick you out. For us, that means having a way of telling all the people you invited to the party (the visitors to your website) where to go instead. ‘Cause, y’know, there’s always another unsecured warehouse somewhere. ;)
Your escape route: buy a domain name
At this point, the single most important thing to do to ensure you have control over your website and these companies can’t keep your content hostage, thereby making you dependent on them, is to buy a domain name. Yes, I said “buy.” Sadly, this is the one step that will cost you some money. Fortunately, the amounts we’re talking about are something on the order of $8 or so a year. That ain’t so bad. I mean, you can probably busk that much in a couple hours on a busy street corner. And for the amount of self-determination your own domain name gives you, it’s well worth it.
Moreover, buying a domain name is something you’d have to do anyway, even if you did get a website from a web hosting company. It’s just that most web hosts will say they offer deals like “free domain name with purchase of hosting plan!” but what they’re really doing is discounting you the price of their (unreasonably expensive) domain name registration service for the first year, and not telling you how much the annual renewal fee is.3 See that asterisk? Yeah, pay attention to that slimy bastard.
Buying a domain name is like getting a PO Box at the post office. It’s just a pointer to you, an address, a way of telling other people “if you want to send me something, put this lettering on the outside of your parcel.” When you invite visitors to your cyber house party website in someone else’s warehouse, you’ll do the same thing: “if you want to party at my website, put this address (domain name) on the top of your web browser.”
So, get a domain name. LifeHacker has some good suggestions for how. Get it cheap—no point in paying bunches for what is essentially a forwarding address, which is the same no matter where you get it, right? I’m sure that if “MyCoolBlog.com” is already taken you can come up with another one. It doesn’t really matter where you get it from. You can even get it from a web hosting company; most web hosts will offer a “domain name registration only” option but they usually charge more for it than a domain registrar does, because they’re resellers and in that case you’re buying the domain name retail, not wholesale.
With an escape route in the form of your own handy dandy domain name in hand, it’s time to party where the authorities ain’t lookin’.
Invite yourself in
Time to pick a warehouse. There are actually quite a bunch to choose from. Any free blog hosting service that lets you use your own domain name will do. As far as I know, WordPress.com, Tumblr.com, and BlogSpot.com are all popular examples of such services. For the purposes of this walk through, we’re gonna use Tumblr, and so while the details I’ll write up are specific to that service, the general principle applies to all of them.
First, we make a Tumblr account. That’s easy enough. You just go to Tumblr’s sign up page and fill in your details (username, password, and email address—none of which has to have any obvious link to you, personally, except email address, I guess). It’s super easy because, again, they’re trying to trap you. But don’t worry, we’re gonna side step that in the next steps.
Once you’ve logged in, the first thing you need to do is set up your escape plan. That’s your domain name. Failing to do this is the thing that traps people. Don’t get caught; don’t skip this.
Tumblr, just like WordPress and BlogSpot, lets you use the account you made with them in conjunction with your own domain name. They call this feature a “custom domain.” It’s called “custom” because if you don’t use your own domain name, they give you one. The catch is, the domain name they give you is one they control. Like, Police State style control. I mean, like, not even the cyber-magician version of Harry fucking Houdini could get free of that domain name.
So, obviously, don’t use it. Use yours, instead.
Tumblr describes how to set up your account with your custom domain in their support pages. Some domain name registrars do this, as well. For instance, GoDaddy has a support page about how to use a domain name you bought with them specifically as a Tumblr custom domain. Handy!
The basic idea here is simple: rather than tell people, “hey, meet me at Tumblr!” which puts Tumblr (technically Yahoo!, Inc.—yes, the same Yahoo! who, in all their complacent stupidity, let your sexy fun time cam sessions get into the hands of the NSA) in control of, well, everything, you say, “hey, meet me at MyCoolBlog.com”. Since “MyCoolBlog.com” (or whatever domain name you picked) is just a forwarding address, you control where that ultimately forwards to. Using a custom domain is one part of the puzzle that lets you, at any time, for any reason, change where you’re partying without needing to explain yourself to anyone. Because asking for permission from some other entity who’s just out to keep you hostage is called an abusive relationship, so frak that shit to hell.
You’ve scoped out the warehouse and an escape route. Everything is nice, and quiet, just waiting for you to bring the party. There’s only a few last things you need before you can get things started: supplies!
If this were a physical rave or some such, that means we’d need things like amps, DJ decks, and of course cars or trucks to move that stuff to the warehouse—as well as to make a quick getaway. The cyberspace version is similar. We need some way of moving stuff to and from the warehouse quickly and easily, a way that will work with our escape route should we need it.
This is the part that, if you were to go buy web space, you’d be paying someone else to do. And, I mean, you could pay someone else to move your shit (and I bet many of you do; those people are called “movers”), but you also know you don’t have to pay someone else for this. And sometimes, when you do pay someone, they don’t really take good care of your stuff. Especially not the antique, sentimental stuff. They don’t really give a shit about you or your feelings anyway, and deep down you know that. They just want to get the job done and get paid.
Web hosting companies are the same way. They don’t give a shit about you. They’re not in this to help you, no matter how much their fluffy marketing copy tries to convince you otherwise. They’re in this to use you, to squeeze money out of you; that’s all money is, a cascading series of threats to genuine human relationships. So, why pay them for something you can do yourself?
The great news here is that unlike the physical world, where moving stuff is exhausting, back-breaking labor, moving stuff on the Internet is literally as easy as pressing a button. Moreover, it’s generally equally easy to move a little bit of stuff as it is to move a lot of stuff. I mean, like, a lot of stuff. Since the Internet isn’t physical—the “space” in “cyberspace” is and always has been kind of a misnomer—the effort it takes to move just a little bit of stuff or a whole lot of stuff is functionally identical. All you have to do is press a button.
Again, if this were a rave, then the amps and DJ decks have to get plugged into one another to do anything cool. For us, and for web hosting companies, the amps and DJ decks are just pieces of software. Specifically, open source software. Even more specifically, free software. So when you’re looking at that list of “features,” and those bullet points read like, “SSH √, Optimized for WordPress √, comes with over 50 software packages √, industry-standard control panel cPanel √!!!!!!11!” and so on, what you need to know is, um…all that software is free. Like, really free. Not like “I can download this stuff illegally on ThePirateBay.com” free. I mean free as in legally, literally does not cost you any money free. I mean free as in did not cost the hosting company any money, either. And yet here they are, trying to sell it to you. WTF, dude?
I used to be surprised that this was a shock to a lot of people. Now I’m just pissed about it. It’s really not fair that an entire economic system is continually scamming people into spending money on stuff that’s free. I know, I know. Food is free, and yet we buy that all the time, too. But the more you think about it, the more that sucks, and there’s no way around the fact that this it’s still, ultimately, a pyramid scheme that you’re on the bottom of. Or a big club—and you ain’t in it.
The fact that all of this “industry standard, world-class” web hosting stuff was totally free confused my friend at first, so I decided to concoct a quick demo so I could “show, not tell” them what I meant. Here, I’ll show you, too.
Your laptop is already pretty tricked out, yo
If you’re on a Mac, like my friend was, all you gotta do is click on the little Apple logo (the at the top of your screen) and choose “System Preferences.” Then click on the “Sharing” icon. Then, in the list with checkboxes on the left, click “Web Sharing.” Over on the right side of the window, a link will appear underneath some text that reads, “Web Sharing allows users of other computers to view webpages on this computer. Your personal website, in the Sites folder in your home folder, is available at this address.” Click that link and, guess what, your web browser will open and a nice-looking page will appear.
Well, if you go to the folder on your computer described above that link (“the Sites folder in your home folder”), you’ll notice there’s a file called
index.html. Hmm. Where have we seen this “.html” stuff before? OH YAH. THE WEB. When you tick that “Web Sharing” box what you’re doing is turning on the proverbial amps and DJ decks, software called a “web server.” And not just any web server software, but the same exact web server software used by the overwhelming majority of commercial web hosting companies.
Don’t believe me? Go ahead and right-click (or control-click) on that
index.html file. Choose “Open with…” and then choose your favorite text editor. Make a change to the file, any change that you’ll notice, like, say, writing “HOLY SHIT MY COMPUTER IS ACTUALLY A WEB SERVER?!?!?!” at the top, save the file, and reload your browser window. Ta da.
So, again, rather than buy all this stuff the web hosting companies are trying to sell you, let’s just go get it ourselves. And hey, if you’re on a Mac, you already have one of the parts, the web server part, so, like, bonus points for you. (If you’re on some Linux distro, like Ubuntu, go to your package manager and search for “apache” or “httpd” and install the latest version of whatever comes up. And if you’re on Windows, you should switch to Ubuntu.)
Let’s get our cyberspace DJ deck!
The other equipment you need to make the amps and such work is something called MySQL. This is a “relational database,” which is kind of like a glorified spreadsheet program (but not really, but kinda). Some of you might have had shitty office jobs in the past where you had to work with software like Microsoft Access or Apple’s FileMaker. This is basically like that, but way better. :)
“Okay, so how do I get MySQL?” you might ask. Well, how do you get any other free thing? You search for it on Google (or, preferably and more privately, StartPage.com) and then you go to the download page of the thing that comes up. In this case, that’ll be mysql.com/downloads. Coincidence? I think not!
There are a bunch of different downloads offered on that page. The one you want is the free one, of course, called “MySQL Community Edition” all the way at the bottom. Free software is generally better anyway, and not only because it’s free (though that’s certainly better). It also tends to be more powerful (unless it’s been intentionally broken by white, straight, male fucktard capitalists). Follow the link under MySQL Community Edition, which takes you to a page where you can download all the free stuff.
You want the “MySQL Community Server,” the first link not labeled as “Commercial” on that page. Clicking that link, in turn, takes you to a page whose first sentence reads, “MySQL Community Edition is a freely downloadable version of the world’s most popular open source database that is supported by an active community of open source developers and enthusiasts.” No kidding! MySQL is so popular, in fact, millions of people get scammed by hosting companies into paying for it! Choose your operating system from the “Select Platform” drop-down box (y’know, “Mac OS X” if you’re on a Mac, “Debian Linux” if you’re on Ubuntu, and so on), and then the package format you want, if there are more than one to choose from. Again, if you’re on a Mac, you want any of the “DMG Archive” ones.
Download it, and what pops up but none other than a very standard application installer. Great! Run it, y’know, just like any other software package. ‘Cause, again, software is software is software. The fact that you happen to be installing “the world’s most popular open source database” that commercial web hosting companies want to sell you doesn’t mean that software has any fundamental difference than, like, Angry Birds.
Depending on your platform, you might have a few other goodies in that file you downloaded. For instance, on a Mac, you’ll have an item called
MySQL.prefpane tucked in there, too. Sometimes it’s got an icon that looks like a light switch. That thing is awesome. It’s a system preference pane (like the “Sharing” one you clicked on earlier), but instead of turning on and off the web server, it gives you a button that turns on and off the database server. (Sounds fancy, but remember, the “database server” is just the DJ deck to which you plug in the “web server,” which is just the amp.) So, double-click that goodie to get it installed into your Mac’s System Preferences. Then click the “Start” button. You’ll be asked for your computer’s admin password (which should make you feel all warm and fuzzy because security precautions are good things), and then you’ll be greeted with the line, “MySQL server is running.” wOOt!
Plug the DJ Deck thing into the amp thing
Rave equipment doesn’t just work on its own, right? Like, you can’t just bring a bunch of lights and some vinyl records and dump them in a pile and expect them to work. Ditto for computers. You gotta plug the one thing into the other thing.
It’s not as hard as it sounds. And there aren’t even wires. ‘Cause, software. So yay.
Like wires, however, there are actually quite a number of ways to connect thing A with thing B. We’re gonna do the simple, free, relatively easy thing, though. Why? Because. Screw working hard.
For this to work, though, we need to get another one of those “50+ software packages √ !!!11!” that web hosting companies use in their stupidly redundant list of features. It’s a thing called “phpMyAdmin.” The “My” in the title is a reference to none other than “MySQL.” The “admin” means “administration,” just like when your computer asks for “an administrator’s username and password” before it does something, y’know, administrator-y. So phpMyAdmin is just a program that lets us do administrator-y things in a point-and-click way with the MySQL thing we just installed.
“Okay, so, how do I get phpMyAdmin?” Well, how do you get any other free thing on the Internet?
This time, the file you download won’t be a platform-specific installer (like the
.dmg you got from MySQL). It’s a more generic, cross-platform set of files that you can use on pretty much any system at all. All you need to do to get it “working” is to move the file to the right place, open it, and then tell it it’s installed by duplicating (literally, just copying) one of its files to another file of a different name. Sounds weird, but, well, sometimes computers need a bit of a kick in the ass to get up and running.
So, first, move the phpMyAdmin file you downloaded (it probably has a name like
phpMyAdmin-4.1.8-english.zip or something) to the place where your web server is looking for files. Taking the example of our demo from the Mac, earlier, this means “in the Sites folder in your home folder.” Just copy-and-paste or drag-and-drop the file there, and then double-click it. That will create a new folder with a bunch of files in them. The only one you need to worry about is called
config.sample.inc.php, which is a sample configuration file included with the program, as the dotted name implies.
When you open the
config.sample.inc.php file in a text editor (and I do mean text editor, not Microsoft Word or OpenOffice or fancy schmancy word processors, just a plain, good ol whatever-the-default text editor on your computer is, like Text Edit or Notepad or something), you’ll see a file that looks like computer code. It looks like computer code because it is computer code. But there’s also a lot of English-language text. And, if you just focus on the human language and ignore the computer language, in the same way you might do if you clicked some link from Twitter and found yourself at a news article written in a language you don’t understand, you can probably make a bunch of it out anyway.
This is the file you need to copy to tell phpMyAdmin it’s been “installed” (which really just means “moved to the right place on the computer”).
It’s also the file you can use to customize the way phpMyAdmin works for you. The only change you’ll need to make is toggling the option that lets you log in without a password, since, well, you don’t have one. Search (using the “Find…” feature, typically accessed from the “Edit” menu of your text editor, or just by typing ⌘F on a Mac or CTRL F on most other computers) for the phrase
NoPassword. You’ll find it not too far down in the file nestled in the middle of a line that looks like this:
$cfg['Servers'][$i]['AllowNoPassword'] = false;
To “toggle” the option, you just change the part that reads
false to (you guessed it)
true, so that the line now looks like this:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
But don’t just “Save” the file because then phpMyAdmin still won’t know it’s installed. Instead, use “Save As…” and drop the
.sample from the file name. Save it as
config.inc.php, instead. Congrats, you’ve installed a web site program! Pretty much all website programs work this way; you download an archived file, you move that file to the right place on your computer, you open that file to create a folder, and then you save a configuration file, usually one that’s already mostly written out for you.
“But how do I use it?” Well, how do you use any other website? “I…um…go to it in my web browser?” Yup. Do that. “Where is it?” Well, what link did your computer give you when you turned on your web server?
See, a web server isn’t magic. It’s not even a complicated thing. A web server is just a tool that translates file names to URLs and back again. That’s because, at its most basic level, a URL is really a way of describing folders, and files in those folders, on some computer, somewhere. When you “go to Twitter,” for instance, what you’re doing is telling your computer to “open the home page file on Twitter’s computer.” Same thing for a given blog post or, for instance, a website program like phpMyAdmin. That file you downloaded and then unarchived “in the Sites folder of your home folder” became a folder with files in it, which means they now have specific URLs (real, live web addresses!) that you can type into your Web browser’s address bar to load ’em up. Try it.
Go back to the tab you opened when you clicked on the link to “Your personal website” from the System Preferences pane and take a look at the URL. Mine says
http://192.168.1.113/~maymay/. Yours probably says something similar, possibly with different numbers and probably with your own name instead of
maymay, ’cause, duh. You might notice, if you looked carefully, that the name in that web address is the same name of your home folder. That’s no coincidence; that URL translates directly to “the Sites folder in your home folder.” That means that any folder or file you put “in the Sites folder in your home folder” will be available to you at a URL that begins with the one you’re looking at now.
And that means, yup, you can use the phpMyAdmin you installed just by appending whatever the folder’s name that was created when you unarchived the file to the end of this URL. For me, that means the URL to my phpMyAdmin installation is
http://192.168.1.113/~maymay/phpMyAdmin-4.1.8-english/. Load up whatever yours is and, um, you might wanna bookmark that.
If all of your digital wires are plugged into the right spots, you’ll see a pretty typical-looking login screen. But, especially if this is the first time you’ve done something like this, I’m gonna bet you’ll see something that looks like a list of files instead:
That’s happening simply because not all the things are plugged into all the other things correctly. Don’t panic, and don’t feel bad. It’s not something you did wrong. It’s just that you didn’t finish wiring the stage and the lights and the amps and the DJ deck all together yet. So, let’s go through that process and finish plugging things in one at a time. When everything works, we’ll know we got it all right, and we’ll go one piece at a time because that’s how competent people work; slowly and carefully.
Seeing this list of files tells us that the website program isn’t actually starting up. It knows it’s installed, it’s just not able to, like, do anything. And that’s probably because the digital wire between the program and the web server isn’t connected. That specific so-called “wire” is yet another bullet point on those web hosting company’s list of features, called PHP. Web geeks know it as “middleware” because, well, it goes in the middle between two other things. In this case, those other things are phpMyAdmin and your web server. Sometimes, and more generally, we also call this stuff “glue code” because it connects two things, kind of like the way good ol’ Elmer’s glue does to our fingers. And then we push our glasses up on our noses and then TRAGEDY!
Anyhoo, to “glue” the phpMyAdmin thing to the web server, we’re gonna need to edit the web server’s own configuration file. Just like we did for phpMyAdmin, it’s a very small, easy change, but it takes a few steps to complete because the web server is in a part of your computer that you don’t often go to. Thankfully, for us Mac users, it’s still pretty easy.
Back in the Finder, from the “Go” menu, choose “Go to folder….” In the “Go to the folder:” text box, type
/etc/apache2, and click the “Go” button.
This will take you directly to the place where the web server that you control with that little checkbox in the System Preference is configured. You might even notice that you’ve never even seen these files before. That’s because they’re hidden, like the engine of a car, “under the hood.” And just like the engine of a car, you’ve gotta unscrew a few caps in order to actually make changes to the fluid levels and such.
With the “apache2” folder highlighted in the Finder, choose “Get Info” from the “File” menu (or just type ⌘i) to bring up this folder’s info panel. On the very bottom of the window will be a section that reads “Sharing & Permissions:” with a little disclosure triangle on the left. Click the triangle to view the sharing and permission settings. You’ll see a line of text that says, “You can only read”, with three rows in the table organized in two columns. The column on the left is titled “Name” and the column on the right is titled “Privilege.” Together, the table describes “who on this computer can do what with this thing you’re getting info about.”
You can’t pour more oil into your car’s engine before you unscrew the oil cap, and you can’t change anything in this folder before you grant yourself the privilege to do so. Luckily, that’s not hard (and, fortunately for me, neither is unscrewing my car’s engine oil cap). You gotta click the little lock icon in the corner of the window so you’ll be prompted for an admin username and password. This gives you permission to make changes. Since you’re not “system” and you’re not “wheel,” the only row in this permissions table that applies to you is the third one, the one whose name reads “everyone.” So click on the text that says “Read only” to the right of “everyone” and choose “Read & Write” from the menu that pops up. Since we’re going to make changes to one of the files in this folder (not the folder itself), we also need to click the gear below the table and select “Apply to enclosed items….”
Your Mac might ask you to confirm that you are “sure” you want to do this (you are) and that you can’t undo this (that’s not actually true, you can always change it back later, and you will), so click “OK” to confirm the change. Now you can change the oil! I mean, you can glue the things together.
The file in this folder we’re interested in is the one called
httpd.conf. Open that up in your text editor and, just like before, you’ll see a bunch of ASCII-art looking mix of computer-ese and English. If you look (or scroll) down just a tiny bit you’ll see a bunch of lines that all start with the phrase
LoadModule. A few of those lines have an octothorpe, more commonly known as a hashtag (cringe) in front of them. One of those lines with the octothorpe/hashtag/pound-sign/hash-symbol/omg-how-many-names-does-this-thing-have in front of them looks like this:
#LoadModule php5_module libexec/apache2/libphp5.so
That “php” should be familiar by now, no? This line is the glue we’re looking for. It’s our digital wire that connects the phpMyAdmin thing to the web server thing. Right now, it’s unplugged, and we gotta plug it in. We do that by deleting that fucking hashtag. See, in files like this, when they start with that fucking hashtag sign, it means they’re “off.” When we remove the fucking hashtag, we switch them to “on.” This is functionally identical to the way we switched the “false” to a “true” in the phpMyAdmin config file, except, well, even more arcane.
Regardless, get rid of that fucking hashtag so the line now reads like this:
LoadModule php5_module libexec/apache2/libphp5.so
And then, just save the file. No need to Save As or change its name or anything, because the web server is installed and working, we just wanted to change how it’s working.
Now, for the sake of please-don’t-make-it-any-easier-for-the-NSA-to-violate-my-privacy-than-it-already-is, click once on the “apache2” folder and open its “Get Info” window, again. In that window’s “Sharing & Permissions” section, change the privilege in the “everyone” row back to “Read only.” Then, as before, click the gear and select “Apply to enclosed items…”, and confirm your change if you’re asked whether or not you’re sure you want to do this (because OMG you definitely do want to do that).
This little song-and-dance about privileges, in tech-speak, is called “privilege escalation.” It’s good when you’re making changes that you like, and it’s very bad when someone else makes changes you don’t like. Keeping the privilege settings the way you found them after you have some reason to change them temporarily is a very good habit to get into. Might as well start now.4
Finally, stop your web server and then start it up again5 by going back to the “Sharing” System Preference pane, unchecking “Web Sharing” (if it was selected), and then checking it again. You do this simply to make the changes you made take effect. So go back to your web browser, load the phpMyAdmin folder again, and see if they have, indeed, taken effect.
Instead of a list of bunch of files, you should now see that typical-looking login screen. Bravo! You plugged a digital wire into its appropriate spot. We won’t know if we’re totally done unless “everything works,” so now we’ll try to actually log in to MySQL, that thing we installed before we put this phpMyAdmin in your Sites folder and went on this glue code adventure together.
Since we’ve just installed MySQL, there’s only one way to actually log into it, and that’s by using its default username (named
root) and that user’s default password (which is empty, as in, don’t type a password at all). So type root in the Username field and leave the Password field blank. Then click “Go.”
No dice, eh? Again, since this is the very first time you’re plugging all these digital wires into their appropriate sockets, you’ll probably get an error that says “#2002 Cannot login to the MySQL server.” That’s actually pretty useful; error messages are like your computer having feelings. It’s trying to tell you something about itself, and it’s being very specific, but also kind of terse. You can typically copy and paste error messages like these directly into Google (or your privacy-enhancing search engine of choice) and get a lot of help. Sometimes the first search result you get is the program’s own documentation, which you could, like, read.
In this case, the problem is almost certainly one last “glue” thing. Y’see, we have a bunch of equipment now, and we’re gonna have a rockin’ rave. A DJ deck, amps, and lights, right? That’s three things. We’re also working with three main pieces of equipment: MySQL (the database, as in where we’ll actually store all our website content, like the web pages and blog posts and such), Apache (the web server, as in the thing that translates URLs to the files we’re putting on our computer), and PHP (the “glue” that brings it all together). So far, we connected Apache to PHP, but we haven’t yet done the same for MySQL. So when phpMyAdmin says it can’t login to the MySQL server, that’s because it needs to go through PHP to actually get to the MySQL server, but while phpMyAdmin and PHP itself are hooked up together, PHP and MySQL are not. They’re just not talking to each other, but not because they don’t want to or can’t. It’s because they can’t find one another. You gotta help ’em.
Y’see, MySQL and PHP both talk to other programs through a special kind of file called a socket. More precisely, a Unix domain socket. And it really is nothing more fancy than a place to put a file that both programs know about. It just so happens that MySQL, by default, guesses that the socket should be in one place and PHP guesses that it should be somewhere else. We just have to tell one or the other of them to meet up at the same spot.
So we can solve this problem in one of two ways: either we tell PHP to look for the socket where MySQL expects it to be, or we tell MySQL to put the socket somewhere other than its default location, that is, the place PHP guesses it’ll be. Both of those ways involve editing a file or three just like we did before, but it’s easier to tell PHP where MySQL’s socket is than it is to have MySQL change where it puts that socket.6
Just as all these other programs have configuration files, so does PHP itself. To find it on a Mac, as before, go to the Finder, select “Go to Golder…” from the “Go” menu, but this time type /private/etc, and press “Go.” As you can see, there are a lot of files and other folders here. The file we’re looking for now is called
php.ini.default, which is a sample of what PHP’s default initialization file could look like, as its name implies.
This file and, indeed, nothing in the
etc folder is editable by us right now, much like how we found the Apache web server’s configuration file. We need to go through the privilege escalation song and dance. This time, though, we only need (and only should) temporarily change our privileges for the
etc folder itself, and not to the enclosed items. So go ahead and “Get Info” for the
etc folder, click the little lock, enter your computer’s admin username and password, and change the privilege to “Read & Write” for the “everyone” row. Then, open the
php.ini.default file in a plain text editor.
We’re looking for the place in the file where PHP makes a guess about where the MySQL socket file can be found. That file is conveniently called
mysql.sock, so if you do a search for that text you’ll find a few results. Turns out that there are a number of different ways PHP can talk to MySQL, and each way makes its own guess about where the socket is going to be. In this file, these ways are called
MySQLi. So, in various parts of this file, you’ll find three different relevant lines. Respectively, they look like this:
pdo_mysql.default_socket=/var/mysql/mysql.sock […] mysql.default_socket = /var/mysql/mysql.sock […] mysqli.default_socket = /var/mysql/mysql.sock
They’re similar because they’re basically doing the same thing, which is guessing where the MySQL socket file is. As you can see, they’re all currently making the same guess. The only difference is at the beginning, before the dot. You could change all three, which is probably the best thing to do, or you could just change the one that phpMyAdmin uses. If I were you, I’d change all three since they’re all wrong. For the record, though, the one phpMyAdmin uses is the last line, the one for
“What do I change them to?” Good question! The snarky answer is “wherever MySQL’s socket file is.” You’re probably wondering, “Well how do I know where that is?” and, again, good question. You don’t. Unless, of course, you’ve already read the page behind the link “tell MySQL to put the socket somewhere other than its default location,” above. The very first sentence on that page reads:
The default location for the Unix socket file that the server uses for communication with local clients is
So I guess that answers the question. You gotta change the part of PHP’s guesses that read
/var/mysql/mysql.sock to read
/tmp/mysql.sock because that’s “the default location for the Unix socket file.” Make those changes and then use “Save As…” from the “File” menu to make a copy of this file in the same way you did for phpMyAdmin’s configuration file. This time, drop the
default from the end so that the file name just reads
php.ini. Once saved, go back to the “Get Info” window for the
etc you modified earlier and revert the privilege setting for “everyone” back to “Read only,” because I’m serious about getting you into that habit. And, finally, bounce (i.e., stop and start) the web server from System Preferences’s “Sharing” pane by unchecking and re-checking the “Web Sharing” checkbox again. Then, go back to phpMyAdmin in your browser and try logging in with the username root and a blank password.
Ta-da! If all went well, you’re in.
What you’re seeing is a representation of how most of the software listed on a web hosting company’s features list sees your party warehouse space. In much the same way as you’d have to survey an empty warehouse to figure out where the best places to put the amps and lights and other equipment is before you actually put them there, you need to set up where the software you’ll use will actually be placed before you can use this space. Thankfully, that’s as easy as clicking a few of the right buttons.
On the left of your screen is a short list with icons that look a bit like oil drums. These are your “databases.” MySQL itself keeps one (for itself), so one of them will say “mysql” next to it. At the top of the window are a row of tabs, one of which says “Users” on it. Click the “Users” tab to be taken to a page listing all the users MySQL knows about.
This list isn’t the same one as the “user accounts” on your laptop, which is why you’re name isn’t in that list. These “users” are specifically ones created for the sole purpose of using some MySQL database or another. They’re called “users” because the concept is the same as the concept of “users” of your laptop (an account with a name that has certain privileges to do certain things with some data). It’s just that, here, the context is different: a “MySQL database” instead of “your laptop.” Most discrete systems (like “your laptop” or “MySQL”) have this concept and they all call that concept a “user,” which can lead to some confusion about which system’s “user” someone’s talking about at any given time. I typically preface the term “user” with the name of the system it’s associated with, so I’ll use the phrase “MySQL user” to mean “a user that the MySQL system knows about” and “Tumblr user” to mean “an account you made with Tumblr.”
When it comes to users, phpMyAdmin is a little special; it doesn’t have it’s own concept of users. Instead, phpMyAdmin uses MySQL’s users directly. That’s great, because that means there’s less stuff to remember.
Underneath the list of MySQL users that phpMyAdmin shows you here, there’s a link with a little icon of a person and a plus symbol with the text “Add User” next to it. Guess what that does. Yup, it takes you to a page where you can make a new MySQL user. Click that, and you’ll see a form that asks for the typical things like username and password, but also asks for a “Host” and gives you a bunch of options in the form of checkboxes under a couple additional sections that might scroll off the bottom of your window. We can ignore most of those.
All you have to do here is type a username in the username field (but it keep it short and without spaces, like, say,
party_warehouse or whatever). You can leave the host field at it’s default value of “Any host” but it’s safer to choose “Local” from the drop-down menu. As you can see, that replaces the percent sign (
%) in the text box on the right with the word
localhost. This just means “instead of allowing someone claiming to be
party_warehouse to access MySQL’s information from anywhere on the Internet (which is what “any host” means), only let them access this information if they’re coming from this computer.” Again, using the most restrictive settings possible that still let you do what you need to do is a really good habit to get into, so why not start now? Finally, choose a password. I like to click the “Generate” button, and copy the password that appears to a text editor’s window. It doesn’t matter what you put here, and you’ll only need to remember it for a few minutes (hence pasting it into a text editor temporarily).
And then, the last important thing: in the section with the heading “Database for user,” check the box labelled “Create database with same name and grant all privileges.”
With that all set, scroll to the very bottom and click the “Go” button. phpMyAdmin will show you the list of MySQL users again, and this time you’ll see a new row with the user you just added.
Congrats, you’ve got everything set up just the way you need it! Now it’s time to metaphorically load up all this metaphorical rave equipment onto our metaphorical cars and trucks and set up our party in Tumblr’s conveniently free metaphorical warehouse.
Objects in mirror are closer than they appear
From here on out, you’ve set yourself up as a one-person personalized web hosting space provider. Sure, only you and your roomies can fit in your tiny dorm room of a house party at the moment, but you are running a database server (MySQL), and a web server (Apache), and you’re able to use most if not all of those “50+ free software packages!!!!11!” that the web hosts are selling you. The trick now is to move the party over to Tumblr (or some other freely available cyber warehouse with your own escape route), so you can invite the whole town.
Earlier, I said that moving a little bit of stuff is just as easy as moving a lot of stuff. You’re about to see what I mean. Let’s go get our metaphorical trucks to move all our metaphorical rave equipment around as if we were faster than a speeding bullet, and stronger than a locomotive. To do that, we need another free software tool: WordPress.
A lot of people know about WordPress because of the hosted service they offer, called WordPress.com. Exactly like Tumblr, they’ll let you use a “custom” domain name if you have one, and they’ll lock you into a Houdini-proof domain name of their own if you don’t. But what a lot of people don’t know is that the same software that powers WordPress.com is available to you in a stand-alone version, for free, and it can actually do more, not less, than what you’re given if you use WordPress.com.
And how do you get WordPress, which is free software? Bingo:
Installing WordPress is very much like installing phpMyAdmin. After you download the latest version of WordPress, you’ll have to move the archive file to “your Sites folder in your home folder” and double-click to open it. This will create a folder unsurprisingly called
wordpress that will be available to your web browser just like the folder for phpMyAdmin is. For me, that means I get to it by going to a URL like
http://localhost/~maymay/wordpress. Your URL will be the same, except with maymay changed to whatever the name you use for your computer account is.
When you go there, WordPress will tell you that “There doesn’t seem to be a
wp-config.php file. I need this before we can get started.” Remember how we had to open and then “Save As” the phpMyAdmin configuration file? The same thing applies to WordPress.
Take a look through the folder that the WordPress software made, and you should find a file called
wp-config-sample.php. Open it up in a text editor and, just like before, you’ll see a lot of computer-ese mixed in with English. Right near the top there are some lines that describe “MySQL settings.” There’s even placeholders for you that read
password_here, for the database’s name (like, say,
party_warehouse), the MySQL username (like, again,
party_warehouse), and the password (which is that gobblygook you copied from phpMyAdmin and pasted into that text editor window just a few minutes ago).
Simply replace the placeholders in the sample WordPress configuration file with the values you entered into phpMyAdmin earlier and then choose “Save As” from the “File” menu, just like you did before. As you might have already guessed, this time we’re going to save the file as simply
wp-config.php, dropping the
-sample from the original file name. After that, reload the WordPress tab in your web browser, and…voila!
As you can see, you’ll now see the “WordPress Famous 5 Minute Install” screen. This screen looks exactly as it does and asks for exactly the same information as what you’d be asked for if you had ended up buying some web space from some web hosting company and then asking them to please install WordPress. They’d send you to a page very much like this one.
Once again, you’re asked for a “username.” This isn’t a MySQL user or your computer’s user. WordPress has its own user system, much like MySQL. When WordPress asks for a username, it’s asking for what I call a “WordPress user,” or a user account within the WordPress system. There aren’t any user accounts within this WordPress installation yet, so we’re asked to make one. Go ahead and fill in the fields as you would for any other website, and then click on “Install WordPress” at the bottom.
When WordPress responds, it’ll say, “Success! WordPress has been installed. Were you expecting more steps? Sorry to disappoint.” WordPress is a little cheeky that way. Get used to it.
Click the “Log In” button and fill in the username and password you entered in the screen before. Then click “Log In” again. Welcome to your own, personal WordPress Dashboard, my friend, your Fortress of Solitude. This is the metaphorical driver’s seat of your metaphorical truck. Over on the left, you’ll see a menu bar with items like “Posts” and “Pages” in it. That’s the metaphorical trunk or bed of your metaphorical car or truck. “Posts” is where you’ll write your blog posts. Clicking it will show you a list of posts (metaphorical “stuff”) that are currently saved inside your database (metaphorical “bed of your truck”), and this is another URL you might wanna bookmark, by the way. There’s just the one post now, called, “Hello world!” but there’s a button at the top labelled “Add New.” Clicking that will bring you to the “Add New Post” screen, where you can write whatever you want the world to know.
The next and final step in getting yourself over to Tumblr’s warehouse is installing a WordPress plugin called Tumblr Crosspostr. WordPress plugins are also free software that you can find, download, and install the same way you found, downloaded, and installed WordPress itself. The only difference is that when you download their archive file, you have to put them in the “plugins” folder inside the “wp-content” folder inside the “wordpress” folder, and they usually don’t need you to edit a configuration file. Go download the Tumblr Crosspostr file, move it to the
plugins folder in the
wp-content folder in the
wordpress folder in your
Sites folder in your home folder (or
~/Sites/wordpress/wp-content/plugins for short), and double-click it to unarchive it.7
With the Tumblr Crosspostr WordPress plugin installed, go back to your WordPress screen in your web browser, and click on “Plugins” over on the menu bar on the left. Much like you saw when you clicked “Posts,” you’ll see a list of the available plugins WordPress knows about. It knows about Tumblr Crosspostr because you put it in the place it expects to find plugins. Underneath the name of each plugin are links that read “Activate” and “Delete.” I bet you can figure out which one under Tumblr Crosspostr you want to press. :P
After you activate Tumblr Crosspostr, the plugin will offer you a button at the top of the screen labelled “Connect to Tumblr.” Click it to go to the Tumblr Crosspostr configuration screen. Things are pretty self-explanatory from here on out. Back on Tumblr Crosspostr’s download page, it even provides screenshots explaining how to set it up. So, y’know, follow those directions.
Most of Tumblr Crosspostr’s defaults are fine, but I encourage enabling the “Sync posts from Tumblr” feature, as well as answering “No” to its question of “Use permalinks from this blog as the “Content source” for crossposts on Tumblr?” I think you’ll probably also want to delete everything in the “Add this markup to each crossposted entry” box. Those settings are ideal for using Tumblr Crosspostr as our metaphorical truck.
Once you’ve configured it the way you like, click “Save Changes” at the bottom. And then, well, then you’re done. Try it out.
Go back to the “Posts” screen, add a new post, write something about yourself and how cool it is that you’ve now got your own computer set up to be your web host, how liberating it feels to know that you’ve set yourself up to be as free as a bird, that no service like Tumblr or WordPress or even Google can keep your blog hostage from you ever again from now on, and then click the Publish button.
Remember how, earlier, I said that moving a little bit of stuff is just as easy as moving a lot of stuff and that all it takes is the press of a button? Yeah, that’s the button you just pressed. No matter how many posts you write, no matter how many reblogs you get (or make!) on Tumblr, whenever you want to write something original and new, just come back to the WordPress here on your computer, add a new post and, well, publish something.
To prove to yourself that it all worked, click the “View post on Tumblr” link that appeared at the top of your post editing screen.8 You should see whatever you published show up as a post on your Tumblr blog.
There you have it. Your data. On your computer. (To back up your website, just back up your computer, which you’re already doing, right?) And available via Tumblr to everyone on the Internet. And easily portable to anywhere else you might ever want to go. Forever. And for no hosting cost whatsoever.
Ahhhh, I do so love the smell of restrictive preconceptions burning in the morning. ;)
- Okay, well, a domain name will cost something, but we’re talking something like $8 a year, so it ain’t that bad. [↩]
- This is what’s technically known as bandwidth. The “band” refers to the kind of thing it is, like a channel, and the “width” is an analogy for “how much stuff can fit in there.” This same analogy is used in the term “broadband,” for example. Radio geeks may also be familiar with the term “narrowband.” [↩]
- For an example of this, read Web Hosting Pad’s Billing Policy closely, the bastards. [↩]
- Mac OS X also happens to come with a handy little tool called “Repair Disk Permissions” that you can use to reset all the privilege settings on all your files on your entire computer to their defaults. You can find it in the “First Aid” tab of the “Disk Utility” application in your “Utilities” folder in your “Applications” folder. You can also find it by typing “Disk Utility” into Spotlight. I highly recommend using this tool from time to time! [↩]
- In tech-speak, this is called “bouncing.” I don’t know why and I think it’s silly. [↩]
- The reason it’s easier to change PHP than it is to change MySQL is because, actually, “MySQL” is not one program. It’s a bunch of different programs that all work together. If you were to change MySQL’s default socket location, you’d have to do so for all the individual MySQL programs. That’s not hard since, again, it’s just changing one line in each of the appropriate files, but it is more files, and thus more editing, and thus more time, and thus—SQUIRREL! [↩]
- As some of you probably know, WordPress does have an “automatic” plugin installer, but it relies on some additional setup steps that we haven’t walked through. If you try to use the automatic installer feature anyway, you’ll be asked for “Connection Information,” which is a bit misleading because nothing you enter into those fields will actually work. WordPress’s automatic installer relies on something called suExec, which isn’t too complicated to set up, but it is more complicated than I’m willing to get into right now. Besides, it’s not technically necessary because all the “automatic” installer does is download and move files into the right place, which you’ve been doing all along anyway. :P [↩]
- That link just takes you to the specific post you published using your custom domain name. You can always get there yourself by typing your custom domain name into your Web browser’s address bar, the same way you’ll tell other people to find your blog. [↩]