
As a precursor to researching Apache replacements for work, I decided to look at lighttpd at home. I already have php5 installed (incluing fast-cgi support). Here is how I installed lighttpd in my setup. These steps were carried out as root.
cd /usr/ports/www/lighttpd
make install clean
I had to make sure mysql support was included, and dropped ipv6 support (Serisouly, I’m not going to see v6 for years). Didn’t take long to compile, so straight to configuring:
Edit the file /usr/local/etc/lighttpd.conf and uncomment the line “mod_cgi”, “mod_fastcgi” and uncomment the entire section under #### fastcgi module. This enables php to work. Save the file and exit.
Lighttpd logs to /var/log/, so lets create the files now to avoid problems later:
cd /var/log
touch lighttpd.error.log
touch lighttpd.access.log
chown www:www lighttpd.error.log
chown www:www lighttpd.access.log
and for good measure create the folder for the pid file and make www the owner and group:
/var/run/lighttpd/ and
chown www:www /var/run/lighttpd/
Configuring the server to start on boot is as simple as editing /etc/rc.conf, but we also need to specify the location of the configuration file in another parameter. Add these lines to /etc/rc.conf:
lighttpd_enable=yes
lighttpd_conf=/usr/local/etc/lighttpd.conf
and now start it up with something like:
/usr/local/etc/rc.d/lighttpd.sh start
Mine started flawlessly.
December 22nd, 2007 at 1:44 pm
Really efficient article. I was looking for quick and usefull server instal on BSD, i found a great site.
Thanks