Wordpress, PHP, Fastcgi, Nginx on Slicehost Sub-Domain

So, you have your nifty new Rails 2.0 site up and running on a cluster of Mongrels proxied by Nginx and decide that you want to add a sub-domain to your slice to host a blog describing what your site does, since its “Web 2.0″ name doesn’t make a lick of sense.

First you set up your sub-domain. You go to your Slicehost manager, click on the DNS tab, click on the records link next to your domain and the following:

Type: “A”
Name: blog.mydomain.com
Data: IP of mydomain

and hit create. If you want to test whether the sub-domain was created correctly you can always dig the slicehost name servers for blog.mydomain.com and see if your domain IP comes up.

Now you might take a look at the popular Rails blogging systems, like Mephisto, SimpleLog and Radiant. Even though you’ve heard mixed reviews, you might even try installing them, up to you. But sometimes you have folks on the team who really like and are quite productive with Wordpress and PHP, so why not make them happy – after all, its the holiday season.

The following steps need to be followed to get Wordpress up and running:
1. Install PHP (assuming you have MySQL up and running already):
apt-get install php5 php5-cgi php5-mysql

2. Download Wordpress to your /var/www/blog.mydomain.com directory:
wget http://wordpress.org/latest.tar.gz. Untar and follow the Wordpress installation instructions to cofigure your database.

3. Create and run a FastCGI script. I used the one from this site and it works fine except for one major difference. I had to add the following line in mine to get anything working properly:

FCGI_WEB_SERVER_ADDRS=127.0.0.1

Make sure the script has the proper permissions. I would also try and get it up and running first before adding additional scripting to launch the script at startup.

4. Configure Nginx. Here is what my nginx.conf looks like for the blog sub-domain.

And here is my fastcgi_param file.

After this, just follow the Wordpress install instructions. If you run into trouble, check your Nginx logs, set up logging in your php.ini file and make sure all of your permission are correct on your Wordpress install.

Target System: Ubuntu Gutsy on Slicehost VPS.

Sites Referenced:
Primary source with full install instructions
Secondary source
Has fastcgi daemon script and helpful links
Source for Nginx config

This guy recommends just running the lighttpd fastcgi script:
Source with full install with daemon script

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Leave a Reply