Depending on the type of application you wish to serve up, a variety of programs are available to download for free. In this chapter, we will look at two popular open source web servers, Apache and NGINX.
Apache has been around for a long time and is a well-known web server. You can read about its history at http://www.apache.org/.
To install it onto Raspbian we can use apt-get
. Run the following command:
sudo apt-get install apache2 –y
This will kick off the installation process.
Once complete, we can test it works by visiting localhost
in our web browser on the Raspberry Pi or by visiting the IP address of the device from a second computer, for example http://<ip of rpi>/
.
Tip
If you find the web server is not running, you can use the following command:
sudo apache2ctl –k start
By default, an index.html
page is included with the web server.
To add our own HTML files to Apache, we can place these in:
/var/www/html
Rename the existing...