Welcome to ACWN
An inside view
Introduction
According to the website 'lighttpd (pronounced /lighty/) is a secure, fast, compliant, and very flexible web server that has been optimized for high-performance environments.' And that is all you need for your PHP driven website. It isn't neccessary to install a nginx or Apache httpd server.
Configuration
Ok, let's start.This little Howto assumes that you have a Debian system and you have installed the packages lighttpd and php7.4-fpm. First, please find the file '/etc/php/7.4/fpm/pool.d/www.conf' and in the file you'll find a line like this:
listen = /run/php/php7.4-fpm.sock
This is the socket, which FPM listen on for new requests. Lighttpd needs this socket to send requests of PHP files. FPM parses und runs the PHP script in the file and returns the result to lighttpd.
Here is the config file. Save it in the following location: /etc/lighttpd/conf-available/15-php-fpm.conf
# Start an FastCGI server for php (needs the php7.4-fpm package) fastcgi.server += ( ".php" => (( "socket" => "/run/php/php7.4-fpm.sock", "broken-scriptfilename" => "enable" )) )
The second step is to go to the folder /etc/lighttpd/conf-enabled. Here you create two symlink to activate the fastcgi module and your new configfile.
ln -s ../conf-available/10-fastcgi.conf ln -s ../conf-available/15-php-fpm.conf
The number in the filename is important. First lighttpd activates the module and then configures it. It doesn't work the other way round.
And last but not least you restart your lighttpd server with 'systemctl restart lighttpd.service'.
Thanks for reading :-)