IZ8MBW Fabio

Amateur Radio Station in Napoli - Italy
ITU Zone: 28 - CQ Zone: 15 - Locator: JN70ct

Install and Configure Lighttpd Web Server, PHP and MySQL Database on Raspberry Pi

This guide describe how to do all necessary for install and configure Lighttpd Web Server (in HTTP), PHP and MySQL Database on Raspberry Pi. Gives all commands as root user.
Since March 2017 I have migrated my webserver from lighttpd to nginx mainly because nginx supports HTTP2 and TLS 1.3 and because it is more fast, more secure and really more powerful.

1. As usual, first, upgrade your packages
apt-get update
apt-get upgrade

2. Then, if you have not already done so, download and install rpi-update
apt-get install git-core
apt-get install ca-certificates
apt-get install rpi-update

3. Now, upgrade your system firmware

4. Reboot

5.Install lighttpd Web Server
apt-get install lighttpd

6. If you need the PHP processor module, install it
apt-get install php5-common php5-cgi php5

7. Enable PHP processor module
lighty-enable-mod fastcgi-php

8. If you need MySQL Database, install it
apt-get install mysql-server php5-mysql

9. Restart lighttpd Web Server
service lighttpd force-reload

10. Configure lighttpd Web Server
a. Backup the lighttpd configuration file
cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.ori

b. Open for editing the lighttpd configuration file /etc/lighttpd/lighttpd.conf
vi /etc/lighttpd/lighttpd.conf

c. Change the Server port address, the server.document-root, etc...
server.document-root        = "/var/www.yourdomain.com"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80

11. Restart lighttpd Web Server
service lighttpd force-reload

For more informations you can contact me via email at iz8mbw ]at[ gmail.com.
Fabio Ancona, IZ8MBW

I don't ask for money for any guides and info provided, but if you want you can offer to me a beer. Thanks!