Install Nginx on Ubuntu 18 - Nginx is one of the most popular web servers in the world and is used on websites with heavy traffic. It is more server-friendly than Apache in many cases and can be used as a web server or Reverse Proxy.
In this article, HOSTVN will guide you to install the latest version of Nginx on Ubuntu 18.04. At the time of writing the latest version is 1.17.10
Instructions for installing Nginx on Ubuntu 18
To get started, you need a VPS with Ubuntu 18.04. If you do not have a VPS, immediately refer to the packages Cloud VPS of the HOSTVN.
1. Step 1: Install the necessary packages
First you need to install the necessary packages with the following command
sudo apt install curl gnupg2 shift-certificates lsb-release -y |
1. Step 1: Create a source repository
Next, you create a source file repository for Nginx.
- If you want to install Nginx stable version (v1.16) you run the following command
sudo echo "deb http://nginx.org/packages/ubuntu` lsb_release -cs` nginx " | sudo tee /etc/apt/sources.list.d/nginx.list |
- If you want to install Nginx Mainline version (1.17) you run the following command
sudo echo "deb http://nginx.org/packages/mainline/ubuntu` lsb_release -cs` nginx " | sudo tee /etc/apt/sources.list.d/nginx.list |
To verify the integrity of the packages downloaded from this repository, you need to enter the Nginx public key with the command below
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add - |
Proceed to Verify key with the following command
sudo apt-key fingerprint ABF5BD827BD9BF62 |
Finally, proceed to update with the following command
sudo apt update sudo apt upgrade -y |
2. Step 2: Install Nginx
To install Nginx you just need to run the following command
sudo apt install nginx -y |
After the installation process is complete, run the following two commands to start Nginx
sudo systemctl start nginx sudo systemctl enable nginx |
To check the installed Nginx version, use the following command
3. Note
In version 1.17 Nginx has removed the directories modules-available, modules-enabled, sites-available, sites-enabled, snippets and the structure of / etc / nginx will be the same as Nginx on CentOS, this time the vhost files will be loaded in the directory conf.d
4. Video tut
5. References
6. Conclusion
In this article HOSTVN I have instructed you to install the latest version of Nginx on Ubuntu 18.04. If you have any comments you can leave a comment below. Also you can see more Instructions on how to install LEMP on Centos 7.
0 Comments