Here is how you can install Nginx on Ubuntu. In particular on Vultr’s instance i.e. Ubuntu 16.04 / 18.04 LTS / 18.10 / 19.10.
- Have an Ubuntu 16.04 x64 / 18.01 x64 / 18.10 x64 / 19.10 x64 instance.
- Logged in as a root with sudo privileges.
To get started with the installation of Nginx, follow the steps below:
Install Nginx on Ubuntu
Before to install server, run the following commands first to update Ubuntu:
sudo apt update sudo apt upgrade
Next, install Nginx web server with the following command:
sudo apt install nginx
This is it, Nginx is installed and it starts automatically. You can check the Nginx service status by using the following command:
sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2019-11-08 13:15:24 UTC; 7s ago Docs: man:nginx(8) Main PID: 23018 (nginx) Tasks: 2 (limit: 2287) Memory: 5.7M CGroup: /system.slice/nginx.service ├─23018 nginx: master process /usr/sbin/nginx -g daemon on; master_process on; └─23019 nginx: worker process Nov 08 13:15:24 yourdomainname.com systemd: Starting A high performance web server and a reverse proxy server... Nov 08 13:15:24 yourdomainname.com systemd: Started A high performance web server and a reverse proxy server.
The other following commands used to stop, start and enable Nginx service.
sudo systemctl stop nginx.service sudo systemctl start nginx.service sudo systemctl enable nginx.service
Verifying the Nginx Installation in Browser
To verify that Nginx working, open your browser, write your domain name or server IP address i.e.
http://YOUR_IP_OR_DOMAINand you will see the following default Ubuntu Nginx welcome page.
You have learned how to install Nginx on Ubuntu server. You can repeat the steps we outlined above and install it on additional new Ubuntu servers.