How to install and configure Lighttpd, PHP and MySQL or Mariadb on Linux

To improve the performance of my 512MB Linux VPS, I decided to use Lighttpd for my web server instead of Apache. The reason for this change was that Lighttpd consumed less resources, was faster and supported Caching.