Tag: wordpress

The RSS Cloud – Real Time Blogging

As with any WordPress Blog and pretty much any other blog or news website projectroon.co.uk has an RSS Feed and if you look closely at the source of this RSS feed you may notice a new element

<cloud>

What is this? Well currently most Feed Aggregators will poll selected RSS feeds and check if there are any new items. This can be slow and resource heavy especially for someone like Google who has to check millions of feeds many times every day with their reader technology

The cloud element has always been available in RSS 2.0 however most have ignored it or failed to appreciate its possible uses.

Anyone who is familiar with a Blackberry mobile phone will know just how much money they save in data charges by using the Blackberry’s Push technology. Push technology means that the phone doesn’t have to keep connecting to it’s mail server and asking if there are any new emails available. Instead the server waits until it has a new email and then contacts the phone to deliver it. This results in far less load on the mail server and means you don’t have to wait to receive your email.

The RSS cloud works in the same way, feed readers that support the cloud element will be informed every time a blog owner publishes a new post, meaning readers using that reader will be able to start reading instantly after posting.

Find out more from the Official Announcement by WordPress or add support for the RSS cloud for your wordpress blog here

How to get Ubuntu 8.04 Server running Lighttpd ready for the mighty WordPress

Lighttpd - Fly Light

Lighttpd - Fly Light

This site has always been hosted on shared hosting, along with a few other blogs I maintain for friends (On The Wrong Planet and Darth McCarth to name a couple…). Even while I was freelancing I have always used shared hosting as it has always been perfect for my needs However the popularity of this blog has grown a lot in the last 7 months so I felt it was time to invest in some meatier hosting to something that would give me more control over the resources available to me and my site.

I don’t think that I require a dedicated server quite yet, especially not considering how much they cost for a reasonable one, so I decided to take the Virtual Server route. There are many very decent offers around, I chose to go with CheapVPS (A brand of VAServe Ltd) on the reccomendation of a colleague and Linux Engineer. Right lets get started then!

Install Lighttpd (Lighty)

I am assuming that you already have Ubuntu 8.04 installed on your VPS here as most VPSs come with the operating system pre-installed or provide a system like HyperVM to manage your server setup. I am also assuming that you have root access to your server, which is also provided by most VPS. If you don’t have root access then you will need to prepend these commands with sudo.

Log in as root and type:

apt-get install lighttpd

Watch as Lighty is downloaded and installed on your system. Once Lighty is installed you may want to remove Apache as it will probably just get in your way! To remove type:

apt-get remove apache2

If you have installed with a default setup then you will find Lighty’s main configuration at /etc/lighttpd/lighttpd.conf and the service script will be located /etc/init.d/lighttpd

to start, stop, restart or reload Lighty use these commands respectively:

/etc/init.d/lighttpd start
/etc/init.d/lighttpd stop
/etc/init.d/lighttpd restart
/etc/init.d/lighttpd force-reload

Configuring Lighty for Virtual Hosting

In a similar fashion to Apache, Lighttpd keeps its configuration files in one location and expects you the create a symlink to them from another location to active certain features. These two folders can be found at /etc/lighttpd/conf-available and /etc/lighttpd/conf-enabled.

To enable virtual hosts and create the symlink type:

ln -s /etc/lighttpd/conf-available/10-simple-vhost.conf /etc/lighttpd/conf-enabled/10-simple-vhost.conf

Before creating the Lighty configuration for the virtual hosts we need to create all of the folders and files that are going to be required. As I allow my friends access to the server to modify their own websites I need to make sure that they don’t have access to other users websites. To create a user type:

adduser username

Where username should be replace by whatever username you want. Once a user is created we need to create the folders where their website files and logs are going to be stored and give them the correct permissions and ownerships. Again replace username with whatever you like and domain.com with your domain:

mkdir /home/username/domains
mkdir /home/username/domains/domain.com
mkdir /home/username/domains/domain.com/html
mkdir /home/username/domains/domain.com/logs
touch /home/username/domains/domain.com/logs/access.log
touch /home/username/domains/domain.com/logs/error.log
chown -R username:username /home/username/domains
chown www-data:www-data /home/username/domains/domain.com/logs/*

You can repeat this process for however many users and domains that you require. Or if you know what you are doing you could create a script to automate this process.

Now lets edit the virtual hosts config file:

vi /etc/lighttpd/conf-available/10-simple-vhost.conf

Now here is an example config block for pureroon.co.uk:

$HTTP["host"] =~ "(^|.)(panicroon|pureroon|roon)(.co|.me).uk$" {
    server.document-root = "/home/roon/domains/pureroon.co.uk/public_html"
    server.errorlog = "/home/roon/domains/pureroon.co.uk/logs/error.log"
    accesslog.filename = "/home/roon/domains/pureroon.co.uk/logs/access.log"
    url.rewrite = (
        "^/(wp-.+).*/?" => "$0",
        "^/(sitemap.xml)" => "$0",
        "^/(sitemap.xml.gz)" => "$0",
        "^/(robots.txt)" => "$0",
        "^/(xmlrpc.php)" => "$0",
        "^/(favicon.ico)" => "$0",
        "^/(cgi-.+).*/?" => "$0",
        "^/(icon.+).*/?" => "$0",
        "^/(.+)/?$" => "/index.php/$1"
    )
}

The first line

$HTTP["host"] =~ "(^|.)(panicroon|pureroon|roon)(.co|.me).uk$"

is telling lighty which domain to look out for, you can use regular expressions here and you can see that I am capturing panicroon.co.uk, pureroon.co.uk and roon.me.co.uk. I then let wordpress redirect the user to the correct domain (pureroon.co.uk).

The next 3 lines are telling lighty where to find the document root (the location of your web files), and the locations of the error log and access log respectively.

To be able to use URL rewriting in your wordpress blog you need to set up the url.rewrite lighty module. The problem I have found with the url rewriting is that lighty doesn’t support the Apache ‘if file doesn’t exist function’ so you have to give it a list of files that shouldn’t be rewritten:

"^/(sitemap.xml)" => "$0"

will redirect ‘/sitemap.xml’ to itself. The final line:
"^/(.+)/?$" => "/index.php/$1"
redirects all other requests to ‘/index.php’ and the wordpress software will take care of everything from there.

That’s it, restart Lighty and you are ready to start installing MySQL and finally WordPress, check back soon for the next two stages