Lighttpd on ubuntu

Lighttpd is a great web server. It manages resources frugally, and still manages to be fast. If you have a dedicated super duper server, lighttpd is probably not for you. But perhaps you need your machine to do more than just be a web server, or perhaps you are using a virtual dedicated server (vds, vps, whatever they are called - I use slicehost which is great and inexpensive) which means you have a limited amount of ram and cpu. In that case, lighttpd is a great choice for your web server. The main downside, is that it isn't quite as plug and play as apache is. Apache pretty much runs php out of the box, and installing phpmyadmin just works. There are plenty of guides for getting rails to work with lighttpd, but I couldn't find anything very useful for lighttpd and php (especially with fast-cgi). At any rate, I figured out how to set it in Ubuntu (dapper) and figured I would pass share the experience:

Install php with fast-cgi and lighttpd

sudo apt-get install php4-cgi lighttpd
sudo lighty-enable-mod (then select fast_cgi)

sudo gedit /etc/lighttpd/conf-enabled/10-fastcgi.conf

And change the port line to be this instead: (this seems to be a bug in the default ubuntu configuration)

socket => "/tmp/php.socket"

Now restart lighttpd

sudo /etc/init.d/lighttpd reload

Final step: Take over world

Get phpmyadmin to work with lighttpd
(The following steps assume that you have done part 1 properly)

sudo apt-get install phpmyadmin php4-mysql
sudo gedit /etc/lighttpd/lighttpd.conf

And add an alias for phpmyadmin

alias.url = ("___invalid .... other stuff here
"/phpmyadmin/" => "/usr/share/phpmyadmin" # this is the line to add

Reload the server:
sudo /etc/init.d/lighttpd force-reload

(might also need to edit /etc/php.ini and enable mysql, but it might happen automatically too)

0 Response to Lighttpd on ubuntu

Post a Comment