Lighttpd is a lightweight web server, with all the essential functions of a web server
sudo apt-get update #download package lists from the repositories
sudo apt-get -y install lighttpd .
PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
sudo apt-get -y install php5-common php5-cgi php5
sudo lighty-enable-mod fastcgi-php #Enable the Fastcgi module which will handle the PHP pages
sudo service lighttpd force-reload #restart the Lighttpd service
The /var/www is the root directory of the website, it is currently owned by the “root” user. We must ensure the "Pi" user account can write files to /var/www directory.
sudo chown www-data:www-data /var/www
sudo chmod 775 /var/www #permission to write to this directory
sudo usermod -a -G www-data pi #add the “Pi” user to the “www-data” group
Reboot the Raspberry Pi, your Raspberry Pi web server is ready.