I would first like to start off by thanking Mark at RootBSD for hooking me up with a sweet FreeBSD VPS! Their customer service is top-notch. Prices are unbeatable. And best of all… I get an clean untouched installation of FreeBSD.
Please note these instructions are only validated under FreeBSD 7.0-RELEASE and PHP5.
Grabbing the right packages
Install lighttpd:
# cd /usr/ports/www/lighttpd/ && make install clean
Install mysql51-server
# cd /usr/ports/databases/mysql51-server/ && make install clean
Install PHP5
# cd /usr/ports/lang/php5 && make install clean
Install PHP5-MySQL
# cd /usr/ports/databases/php5-mysql && make install clean
Configuring lighttpd
Make changes /usr/local/etc/lighttpd.conf with your favorite editor
Setup your lighttpd configuration as you like; I created a virtual host so I could have blog.friedpancakes.com:
$HTTP["host"] == "blog.friedpancakes.com" {
server.document-root = "/var/www/data/blog.friedpancakes.com"
}
That’s not all. In order for lighttpd to handle PHP properly, fastcgi needs to be configured properly.
Continue editing lighttpd.conf:
Enable mod_fastcgi at the top by uncommenting the line at the top of the lighttpd configuration file.
Before you continue, make sure that you compiled PHP with CGI.
# php-cgi -v
You should get some feedback from that. Now if that’s setup properly, you can continue.
Find the section in the lighttpd configuration file where it says fastcgi.server. Since WordPress uses PHP, this step is required for lighttpd to handle PHP properly.
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/tmp/php-fastcgi.socket",
"bin-path" => "/usr/local/bin/php-cgi"
)
)
)
Ensure that the binary path above is where you have php-cgi.
Setting up MySQL
Open /etc/rc.conf with your preferred editor. Add the following line:
mysql_enable="YES"
This is required to start MySQL. Now start it up!
# /usr/local/etc/rc.d/mysql-server start
Proceed to create the database WordPress will use
# mysql -u root
mysql> create database wordpress; mysql> grant all privileges on wordpress.* to "wordpress"@"localhost" identified by "your password"; mysql> flush privileges; mysql> exit;
WordPress
Now that you have your database setup. Let’s get WordPress on the system. Obviously, make the directories specific to how you configured lighttpd.
# cd /var/www # fetch http://wordpress.org/latest.tar.gz # tar -xzf latest.tar.gz # cp -r wordpress/* /var/www/data/blog.friedpancakes.com/ # mv wp-config-sample.php wp-config.php
PHP
One last thing needs to be done to get PHP to work. When you install PHP from the FreeBSD ports tree, you really are getting PHP at its most pure form. While PCRE is included by default with PHP5, it’s not in FreeBSD. So you must install this part separately.
# cd /usr/ports/devel/php5-pcre/ && make install clean
And that’s it! You should now be able to begin blogging away.