You probably know I like changing my web server every two minutes.While that is not recommended as it causes a lot of downtime, I like experimenting and learning about all the options. That is why I recently was testing the Lighttpd web server.
Here are my thoughts about each server:
Apache is know, in my opinion, for just working. You install it, create a virtual host, and your site is up. Yes, it’s not the most efficient, but many people are willing to make that trade-off between efficiency and ease of use. Tons of applications and CMS’s use
.htaccess files, something which is only available in Apache.
NGINX is known for its low resource usage. Some people find it a bit harder to use than Apache, but it’s amazing with static files. It uses just a few megabytes of RAM for thousands to tens of thousands of concurrent visitors. However, this does require you to set up
php-fpm, but after that, it can do much of what Apache can. Many CMS’s are also adding NGINX rules to their configuration guides as it’s gaining popularity.
Good old Lighttpd, while it has had some memory leaks in the past, is also known for being a low-resource web server. While I find its configuration a bit more complicated, creating a virtual host with a web root takes 3 lines in a config file! It also requires
php-fpm if you want to use PHP applications. Many CMS’s have rewrite rules for Lighttpd, although it’s not as popular as NGINX.
Lighttpd + WordPress
If you’re like me, and want to run WordPress on Lighttpd, then here are the rules you need to add:
url.rewrite = ( "^/(.*)\.(.+)$" => "$0", "^/(.+)/?$" => "/index.php/$1" )
And for PHP-FPM, edit
15-fastcgi-php.conf in conf-available:
fastcgi.server += ( ".php" => (( "socket" => "/var/run/php/php7.0-fpm.sock", "broken-scriptfilename" => "enable" )) )
lighttpd-enable-mod fastcgi lighttpd-enable-mod fastcgi-php
and restart Lighttpd
Read more about Lighttpd on lighttpd.net
Leave your favorite web server in the comments!