Lighttpd fastcgi – How to Restart a Specific Site Without Affecting Others

Having used fastcgi in lighttpd for a while, I wondered if there was a way to restart one fastcgi site/application without affecting other sites. Because I have many fastcgi sites hosted in a single lighttpd instance, and I don’t want them all to be shut down for a little while each time I want to restart a site after deployment.

The solution turned out to be very simple –

  1. Find out the process of the application that you want to restart and kill it.
  2. Access your web site from a web browser and the restart is done.

Actually every time lighttpd starts, it starts all the processes needed for fastcgi and communicates with them through sockets defined in lighttpd.conf. When a process gets killed and you access the site, lighttpd notices that the process disappears and it tries to start another process. So you may find something like this in the error log:


2010-12-29 09:16:11: (mod_fastcgi.c.1734) connect failed: Connection refused on unix:/tmp/XXX.socket-0 
2010-12-29 09:16:11: (mod_fastcgi.c.3024) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1 
2010-12-29 09:16:11: (mod_fastcgi.c.2803) child signaled: 9

I’m using web.py and I only allow 1 process for one site because processes don’t share memory. If you have multiple processes for a single application, I guess you just need to kill them all.

Maybe you are also interested in my article “lighttpd, web.py, spawning fcgi failed“.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove your intelligence before hitting * Time limit is exhausted. Please reload CAPTCHA.