int main( int argc, char *argv[] )
{
while( FCGI_Accept() >= 0 )
{
printf( "%d\n", c );
return 0;
Assuming that the source has been named webcounter.c and application has been compiled (see this post) as webcounter into the /var/fastcgi directory, it’s necessary to add the following lines to the /etc/lighttpd/conf-available/10-fastcgi.conf file:
fastcgi.server += ( "/fastcgi/webcounter" =>;
((
"bin-path" => "/var/fastcgi/webcounter",
"max-procs" => 1,
"socket" => "/tmp/webcounter.socket",
"check-local" => "disable"
)))
then, after restarting lighttpd, we can try the counter at the URL http://ip-of-your-server/fastcgi/webcounter.
Only two notes about the configuration file: the “+” in the first added line before the “=” and the line “max-procs” => “1”, that force lighttpd to execute only one instance of the FastCGI to avoid malfunctions.
References: Structure and options of the FastCGIs’ configuration file
Nessun commento:
Posta un commento