Nginx is a great web server. I am using it on other blogs I owned online. It’s probably the second most popular web servers in used today.. and growing rapidly.
Some will argue that Nginx is more resource-friendly than Apache2 and can be used as a reverse-proxy server.. so it’s pretty good.
This brief tutorial is going to show you how to easily install Nginx web server in Ubuntu 16.04.
Install nginx (Ubuntu)
Before you begin, make sure you have root access to Ubuntu and have updated your server.
When you’re ready, logon to your server as root user and run the commands below to update it.
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get autoremove
After that, run the commands below to install Nginx (Ubuntu)
sudo apt-get install nginx
The commands above tells Ubuntu to go and fetch Nginx’s packages and install.
When you run the above command, Ubuntu will fetch the most stable packages of Nginx and not the latest. To install the latest version of Nginx web server in Ubuntu, read the post below.
After installing Nginx webserver, Ubuntu automatically adds it to its firewall allowed list. To verify, run the commands below.
sudo ufw app list
And the results should be something similar to this.
If Nignx Full isn’t on the list, run the commands below to add Nginx web server to Ubuntu firewall allowed lists.
sudo ufw allow 'Nginx HTTP'
Now web traffic would be allowed to Nginx web server.
Some basic commands to manage Nginx webserver as as followed:
To start Nginx webservers run the commands below.
sudo systemctl start nginx
To stop, run the commands below.
sudo systemctl stop nginx
To restart and reload, run the commands below
sudo systemctl restart nginx
sudo systemctl reload nginx
This how to install Nginx webserver on Ubuntu.