Category Archives: Web

Merging my blogs

Anyone who has come to this page either from photos.jonathangazeley.com or blog.jonathangazeley.com will notice I’ve now merged the two blogs in a single site called www.jonathangazeley.com.

For now there are automatic redirects in place, and my RSS feed and all historic links will continue to work. But please do change your bookmarks, and if you followed both of my old blogs, you now only need to follow this one.

My first Wikipedia article

For someone who nominally “doesn’t like writing”, I rather enjoy writing articles on my blog. I never particularly enjoyed English at school, but now that I have a technical job that requires me only to make brief notes, I relish the opportunity to write about something I’m interested in once in a while.

I’ve been wanting to write something for Wikipedia for some time, but there’s almost nothing I know enough about to be authoritative, but that is specialised enough that I’m the first to write about it. A few months ago I started making some notes and collecting references about St Paul’s Church in Nuneaton, where I grew up. As with most other well-intended projects, it fell by the wayside in my busy life.

However, this week I saw news of Wikipedia’s 10th birthday, and had a slightly more personal reminder that Jimmy Wales, its founder, spoke in Bristol. This was enough of a stimulus to kick me back into action, and I spent some time transferring the article from my computer to a draft article on Wikipedia. I added some references, and after my “probationary period” at Wikipedia (at least ten edits and at least four days of membership) I was able to move the page to the live site.

So here it is – I hope you enjoy reading about St Paul’s church, Stockingford. Hopefully by the time you read this, the page won’t have been deleted by editors.

As with all good wiki pages, there’s more I want to add, and I’m sure the page will be expanded in due course.

St Paul's Church

Some time ago, back in 2001, I set up the first website for St Paul’s Church, Stockingford.

There have been a few iterations since then, but today I’m pleased to announce the latest edition.

It has been fully redesigned to include more dynamic elements, provide more useful information, and require less maintenance. It’s based on WordPress, so we (my Dad and I) no longer have to edit static HTML and mess about with FTP.

As before, the website is kindly hosted by Ridgeon Network.

A strange suggestion

I happened to be looking at the website of a company that offers virtual private servers earlier today. This particular company has a box on their front page with a few questions about what you need your server to do, and it recommends you a suitable server package. But I was slightly surprised at the second-to-last option:

Server sorter

All the other options are sensible, but automated online gambling? I had no idea that there was a legitimate market for such a thing, let alone that a company would risk its reputation by offering a a controversial, although legal service.

Jonathan's Blog now on new "hardware"

This blog, and my other blogs, used to run on a rather old server: two 1GHz Pentium III processors, 1GB memory and 2 x 18GB SCSI hard drives. I host with Ridgeon Network, which is owned by my friend Chris. I help him out with some networking stuff from time to time so he loaned me this spare server for personal use.

A few weeks back one of the hard drives failed. Service continued as normal but it was an acute reminder that the server was getting old.

Recently Chris bought a powerful server for use as a VMWare ESXi hypervisor, along with a large iSCSI SAN to host all the disk images, and powerful shared MySQL database server. As he was moving lots of his servers from physical boxes to virtual machines, I decided to do likewise.

So this website, and my other sites, are now hosted on a CentOS virtual machine, with their databases on a separate CentOS database server. Given that the load average on the old P3 wasn’t very high I wasn’t expecting a noticeable improvement in performance. But how wrong I was! The site is noticeably faster to load and navigate, and in particular the WordPress management interface is miles faster.

All in all, I’m happy with the new platform. To anyone else considering replacing old servers with a virtualised infrastructure, I say go for it. You’ll save tons of electricity, take up less rack space, pave the way for later expansion (by adding more hypervisors or more disks to the SAN) and have better manageability and backupabilitiy.

Audioboo

I heard about Audioboo – a sort of Youtube for audio clips – the other day on BBC Click. I decided to give it a go, since I fairly often embed audio clips in my blog, simply by hosting and linking to MP3s and letting the user’s browser handle the playback. This doesn’t always work out for the best.

So here’s my first attempt at uploading content to Audioboo and embedding it in my blog.

Newbie's guide for Linux Apache web servers

Today a friend (from a Windows background – still a friend?! :P ) asked me how to go about setting up a LAMP (Linux, Apache, MySQL & PHP) server. I wrote him a few notes, not only on how to configure the LAMP stack, but also on how to configure a Linux system properly from scratch, and how to do so securely. There are millions of guides out there that explain how to serve web pages with Apache, but not many of them explain the basics of setting up a secure system too.

I’ve edited these notes slightly to make them suitable for a wider audience, but in essence it’s the same stuff. Hope it’s useful!

OS installation

I recommend using CentOS. It doesn’t really matter whether you choose 32-bit (i386) or 64-bit (x86_64) but use ideally use 64-bit unless there’s a reason not to.

Boot from the CD or DVD of your choice. It doesn’t matter whether you use the full DVD, or the network install CD.

Choose the text-based installer from the boot prompt by typing linux text. The text installer doesn’t install as much extra rubbish as the GUI installer.

In most cases the default options are good enough. One option you should change is to use an NTP time server. This is especially important with virtual machines, since they suffer badly from clock drift.

Choose a strong root password. You will only need it once again. After that, you won’t even even need it for logging on, so there is no need to pick anything memorable. In fact, you are best off choosing a long, random string of mixed-case letters and numbers.

When it comes to choosing packages, deselect as many of the groups as possible. We will add the packages we need individually later on.

Let the installer run its course, and reboot.

Users and passwords

Upon first boot, log in as root using the password you picked before. Now create new user accounts and set passwords:

useradd yourusername
passwd yourusername

Now for setting sudo access. This is like “run as admin” on Windows. Type visudo. In the text file that opens, read down to the line that says

root    ALL=(ALL)       ALL

Duplicate it twice by pressing yyp. Go into insert mode by pressing i and change the username root to your username. When you are done, hit Esc and type :wq to save and exit. Gotta love vi commands ;)

To disable remote root login via ssh, edit the file /etc/ssh/sshd_config using your favourite editor. If you don’t already have a favourite editor, use vi.

Find the line:

#PermitRootLogin yes

and uncomment it and change the value to no:

PermitRootLogin no

Restart the ssh daemon by doing

sudo /sbin/service sshd restart

From now on you can gain root access by using the sudo command, and you won’t need to log in as root again. Log out now by typing exit and re-login as your own user. Forget the root password forever.

Installing packages

First we add a couple of third-party software repositories that have useful stuff.

sudo rpm -Uvh http://download1.rpmfusion.org/free/el/updates/testing/5/i386/rpmfusion-free-release-5-0.1.noarch.rpm http://download1.rpmfusion.org/nonfree/el/updates/testing/5/i386/rpmfusion-nonfree-release-5-0.1.noarch.rpm

Let’s get rid of the stuff we don’t want or need. There are no doubt more than things that can be removed than I’ve listed here, but they can be removed later.

sudo yum remove bluez* pcsc*

Update the system so you’re sure that that latest versions of all software are installed.

sudo yum update

Now we can install the stuff we want for LAMP!

sudo yum install httpd mysql-server php php-mysql

If you are wanting to use any PHP modules/libraries they can be installed here too, such as the commonly-used graphics library gd.

Services

Let’s start the two daemons for Apache and MySQL, and tell them to start on boot.

sudo /sbin/service httpd start
sudo /sbin/service mysqld start
sudo /sbin/chkconfig httpd on
sudo /sbin/chkconfig mysqld on

Apache in its default state will run out of the box. MySQL just needs a root password setting.

mysqladmin -u root password NEWPASSWORD

From now on it’s advisable to GRANT access to specific users on specific databases/tables. Go read about MySQL users.

Firewall

Let’s assume you want HTTP on port 80 open to the world. Open /etc/sysconfig/iptables for editing, and add this line.

-A RH-INPUT -p tcp -m tcp --dport 80 -j ACCEPT

Save and close, and run this to make the changes live.

sudo /sbin/service iptables restart

Editing configs

The main config file for Apache is at /etc/httpd/conf/httpd.conf. It doesn’t need any changes for basic operation, but if you edit it you need to restart the httpd service to pick up the changes.

If you get serious with web publishing from a LAMP platform, you will probably want to read about name-based virtual hosts.

Adding content

In its basic configuration, you should add PHP scripts, HTML pages and other content like images and stylesheets to /var/www/html/. You do not need to restart the daemon for it to pick up new content.

When debugging pages, you will probably find it handy to refer to the error log, at /var/log/httpd/error_log.

Tip: Open two SSH windows to the server – one for editing stuff, and the other for watching the log scroll by as events occur. Use Ctrl-C to break out of it. Do this:

sudo tail -f /var/log/httpd/error_log

A little bit of downtime

On Saturday 15th May (tomorrow) this blog (as well as my photo blog and the Photo Challenge) will be going down for a while in the afternoon and evening.

I host with Ridgeon Network, owned by my mate Chris. Tomorrow some of the servers are being relocated to a new rack and so will be temporarily offline.

I’ll post again when we’re back online :)

servepics.com

A while back, my younger brother Edmund wanted a photo blog, just like his big brother’s :)

I set him up with a free subdomain from No-IP. The address used to be edmund.servepics.com. I couldn’t fault the service from No-IP, but unfortunately free domains don’t only attract impoverished teenage photographers. They attract spammers and phishers, too.

As a result, the entire servepics.com subdomain is blacklisted by:

  • MSN Messenger. Sending a message including a link to his blog is blocked for an “unknown reason”.
  • Bristol University’s malicious content filtering.
  • My blogs. Any comments or links from his blog are automatically sent to spam, no matter how many times I mark it as not spam.
  • Everyone’s email servers. Any email from this domain is binned by most email providers.
  • Countless other people and services who don’t like online criminals.

So I decided it was time he became a man, and I signed him up for his own domain. You can now see his photos at www.edmundgazeley.co.uk. Enjoy!

I didn't buy that!

And hot off the press, another fail entry.

I placed an order with Amazon, and received this confirmation email.

Screenshot - Amazon email

I sure don’t remember ordering an ARRAY(0x6b390274), but hey, if it’s free…