Steps to Install & Configure Lighttpd web server on Ubuntu 20.04 LTS

Lighttpd is a free & open source web server this used for high-performance environments. It is secure, fast & consumes very few resources and capable of serving large loads. It also supports FastCGI, CGI, Output-Compression, and URL-Rewriting.

There are some steps to Install & configure Lighttpd on Ubuntu:


  • Ubuntu machine with Sudo privileges.

Step 1: Update the System.

apt update

Step 2: Install Lighttpd.

apt-get install lighttpd

  • Here is the command output.

  • Check Version.

lighttpd -version

  • Here is the command output.

  • Check Status.

systemctl status lighttpd

  • Here is the command output.

  • The Path of main configuration file for Lighttpd is at /etc/lighttpd/lighttpd.conf.

cat /etc/lighttpd/lighttpd.conf

  • Here is the command output.

Step 3: Now Open Lighttdp web interface using URL.


  • Here is the output.

Step 4: Install PHP & PHP-FPM.

apt-get install php php-cgi php-fpm php-mysql

  • Stop & disable the Apache2 service.

systemctl stop apache2
systemctl disable apache2

  • Here is the command output.

  • Remove the apache2 service.

apt-get remove apache2

Step 5: Configure PHP-FPM to run a FastCGI server on port 9000.

vim /etc/php/7.4/fpm/pool.d/www.conf

  • Find the following line.

listen = /run/php/php7.4-fpm.sock

  • Replace it with the following line.

listen =

  • Here is the output.

  • Restart PHP-FPM service.

systemctl restart php7.4-fpm

Step 6: Next,configure PHP to work with Lighttpd.

  • Open the php.ini file.

vim /etc/php/7.4/fpm/php.ini

  • Uncomment the following line.


  • Here is the output.

  • Open fastcgi config file.

vim /etc/lighttpd/conf-available/15-fastcgi-php.conf

  • Find the following lines.

"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",

  • Replace it with the following lines.

"host" => "",
"port" => "9000",

  • Here is the output.

  • Enable FastCGI and FastCGI-PHP modules.

lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php

  • Reload the Lighttpd service.

service lighttpd force-reload

  • Here is the command output.

Step 7: Test the Lighttdp.http://server-ip/info.php

  • Create a info.php file.

vim /var/www/html/info.php

  • Add the following lines.


  • Change the ownership of info.php.

chown www-data:www-data /var/www/html/info.php

Step 8: Open the php info page.


  • Here is the output.

  • It shows that PHP is working with Lighttpd.

Leave a Reply