JOURNEY OF RASPBERRY Pi

Amar Shukla
absoluteresolution
Published in
3 min readJul 1, 2017

Part- 5 Nginx web server installation on DietPi

Nginx is available in DietPi repository, therefore installation is very simple and similar to other package installation on Debian based distro such as Ubuntu or Mint. Before we start it’s good to know that there are two ways to install softwares on DietPi. One way is to connect the Pi to Display and use built-in DietPi interface to list the available softwares and install it. Listing of available softwares can be accessed at DietPi-Launcher > DietPi-Software > Software Optimized.

Why we are not going to install Nginx using GUI is because when I explored the available softwares list I observed that Nginx + Mysql is available for installation but not Nginx alone therefore we will install it via terminal.

So first thing first, connect to Pi using ssh command ( we have already discussed in last post about how to connect to Pi device using SSH ). My Pi ip is 192.168.1.5 so I will connect it via my ubuntu terminal using

ssh root@192.168.1.5

Enter the password as dietpi which is default password if you have not change it else enter the changed password. If all goes well, you must be connected to your pi device using ssh, if not then diagnose the issue yourself and feel free to ask me for any help regarding this. Now we can install Nginx, issue the below command in terminal -

sudo apt-get install nginx
Nginx installation on DietPi

since we are using sudo therefore we will have to enter password, type ‘Y’ and hit ‘Enter’ key to proceed. It will start downloading dependencies and other associated files required for installation. If all goes well, it will install Nginx successfully.

nginx installation completed

If you see similar screen such as above screenshot then installation is completed successfully. Now its time to test whether server started running in background or not, to know the status issue below command in terminal -

sudo service nginx status
Nginx status

As we can see that Nginx is active and running and default port is 80 so we can test it in our browser as well. Since my laptop and Raspberry Pi are on same network therefore I can test it in my chrome browser running on my Ubuntu, this can be seen in below screenshot.

Nginx test in chrome

So now we are assured that Nginx installation was successful and Nginx is now running on the Pi as a background service.

Conclusion

In this post we learnt how to install and test Nginx on DietPi OS running on Raspberry Pi 2 device. In next post we will setup Python / Django development environment.

--

--