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 web server I’ve used so far:
Apache is known, in my opinion at least, 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. There’s also a ton of tutorials for how to do things with Apache because it’s so widely used. While there are communities for the other web servers as well, Apache has the biggest.
NGINX is known for its low resource usage and speed. Some people find it a bit harder to use than Apache, but it’s amazing with static files, and fast enough with dynamic 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 its gaining popularity.
NGINX is also used a lot as a reverse proxy for Apache, which provides the best of both worlds(the performance of NGINX with the power of Apache). NGINX takes care of things such as HTTP keep-alives, SSL(yes, I know I’m supposed to say TLS) termination, and static files(e.g. CSS, JS, images, etc), while everything else is passed to Apache. By adding just a few lines to your config file, you can also set up caching, which means very few requests will ever hit Apache.
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 literally 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.
That being said, I honestly don’t know why you’d use Lighttpd, unless you’re already used to it. If you want something easy to use and configurable, then use Apache. If you’re after performance, use NGINX. There really isn’t a place for Lighttpd anymore 🙁 . However, it’s always worth a shot, and you might end up liking the configuration format or something like that.
Read more about Lighttpd on lighttpd.net
Leave your favorite web server in the comments!
Affiliate disclosure: This post may contain affiliate links. Affiliate links are special links which allow the destination website to know we sent that visit, and will often set a cookie to remember that. Should you then purchase their product/service, we may get a commission. Learn more.Affiliate link: