Jump directly to main content

How to install an NGINX web server



NGINX (engine X) is one of the top webservers. It has relatively easy learning curve, is fast, and secure. It's a great step into web hosting, and a good first service for many servers.

Install

sudo apt install nginx

Enable, and start

sudo systemctl enable nginx --now

or

sudo systemctl enable nginx
sudo systemctl start nginx

Enable the http port

If you have UFW installed ala the initial server setup guide you'll need to open the http port on the server

sudo ufw allow 80

or

sudo ufw allow http

Check it's working

Open your browser, and head over to your IP address, or domain name. With any luck you should see the default NGINX page, with a "Welcome to NGINX"

Basic checks in case it's not

Check nginx is actually running

sudo systemctl status nginx

In the active section, this should show "Active", if not try starting nginx again

sudo systemctl start nginx

Check UFW port is enabled

sudo ufw status

This should show port 80, and 80 (v6) with ALLOW. If not, run ufw allow again

Next...

Setup an nginx website