Nginx is an open source and lightweight web server that is often used as reverse proxy. It’s one of the most popular web servers in the world and currently hosting many of the high traffic websites.
This article will show you how to install and configure Nginx on your linux virtual private server (VPS) and later we will explore how to set up your own reverse proxy or web server in Ubuntu 20.04 LTS.
1) Install nginx :
$ sudo apt -y install nginx
2) Basic Nginx configuration :
linodelinux@ubuntu20:~$ sudo vi /etc/nginx/sites-available/default
Add the following under “server_name” :
3) Check syntax :
linodelinux@ubuntu20:~$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
4) Restart nginx service :
linodelinux@ubuntu20:~$ sudo systemctl restart nginx
5) Make nginx auto start at boot :
linodelinux@ubuntu20:~$ sudo systemctl enable nginx Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable nginx