Installation of Nginx on Ubuntu
Introduction
Nginx is one of the most popular web servers in the world and is responsible for hosting some of
the largest and highest-traffic sites on the internet. It is more resource-friendly than Apache in
most cases and can be used as a web server or reverse proxy.
In this guide, we’ll explain how to install Nginx on your Ubuntu 18.04 server and use that as a reverse proxy for microservices created in flask and other applications.
Prerequisites
Before you begin this guide, you should have the following:
An Ubuntu 18.04 server and a regular, non-root user with sudo privileges. Additionally, you
will need to enable a basic firewall to block non-essential ports. You can learn how to
configure a regular user account and set up a firewall by following our initial server setup
guide for Ubuntu 18.04.
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-18-04
Step 1 – Installing Nginx
You can install it using the apt packaging system.
Update your local package index:
sudo apt update
sudo apt install nginx
Step 2 – Adjusting the Firewall
sudo ufw app list
Output
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
permitting traffic on port 80 :
sudo ufw allow 'Nginx HTTP'
Verify the change:
Output
Status: active
To Action From
-- ------ ----
OpenSSH ALLOW Anywhere
Nginx HTTP ALLOW Anywhere
OpenSSH (v6) ALLOW Anywhere (v6)
Nginx HTTP (v6) ALLOW Anywhere (v6)
Step 3 – Checking your Web Server
systemctl status nginx
Finally access your website using your localIP address.
http://your_server_ip
You should see the default Nginx landing page:
Conclusion
Now you have installed Ngix server on your Ubuntu. Now you can do the following steps.
- Server Blocking which I will explain in other chapter.
- Install Letsencrypt for Https Access.
- Use this as reverse proxy for your existing webservice such as flask etc..
- Host your website in Ngix.
No Comments