WordPress and Ubuntu

by steve on December 5, 2011



So, you are ready to run WordPress on your laptop so you can work on a web site without having to either be connected to the Internet, or if you are connected, having to wait for that site to load.

There’s lots of different ways to do this, for this article I’m addressing running WordPress on Ubuntu.  Ubuntu 11.10 in my case.  Installing WordPress is easy once you’ve got MySQL, PHP and phpMyAdmin installed in Ubuntu – I’m going to leave that has an exercise for the reader.  It’s outside the scope of this article.

So… it appears you’ve got WordPress installed and running, but when you try to load your WordPress site the only thing you get in your web browser is the home page of your site – none of the other pages show up.  Frustrating!

It turns out that Ubuntu (and Debian Linux) turn off htaccess by default.  In short htaccess is a way to fool a web brower to do things you want when it tries to look at a URL on your server.  In this case WordPress uses it to hand visitors pretty URL’s.  If htaccess is turned off, WordPress won’t work correctly.  You’ll get the home page of your WordPress site, but nothing else.

Setting up Apache2 on Ubuntu is it’s own long topic – here’s a place to start.  Now if you’ve done your googling correctly you’ve got Apache2 up and running, and you’ve got it serving up virtual web servers, now we turn on .htaccess.

In Ubuntu under /etc/apache2/sites-enabled is an entry for each virtual web server you have running.  Perhaps you’ve got a site called superkitty.com.  In your terminal window, while you’re in the /etc/apache2/sites-enabled directory we need to give a command like this:

sudo pico superkitty.com

(ok – go off and learn how to use Pico and sudo.  We’ll wait.)  Make sure you’ve got something like this in that file:

<Directory />
     Options FollowSymLinks
     AllowOverride all

Now kick your Apache2 configuration in the head.  In the terminal type:

sudo a2enmod rewrite

You’ve got Apache good and woozy.  It’s time to tell it to restart.  In the terminal type:

sudo /etc/init.d/apache2 restart

H’okay.  Now your Ubuntu-based WordPress sites should be working properly.  Yay!  Feel good about yourself and consider getting some icecream!


Comments on this entry are closed.

Previous post:

Next post: