HostUp

How to Install & Configure Latest Nginx Mainline Version on Ubuntu 16.04 / 18.04

Why am I writing this tutorial?

Hi there again! I choose to write this tutorial because I have gotten very frustrated looking around for tutorials that actually work for the latest version of Nginx. All other guides only works for Nginx 1.12 and below, even though the current version is 1.15.8. This is simply dumb and I hope that with this you do not have to look around for hours upon end without any progress whatsoever!

Install Nginx

To install the current version of Nginx, simply follow the documentation on its offical website seen here or do the following commands:

sudo apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/mainline/ubuntu `lsb_release -cs` nginx" \     | sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add - 

Now that we have downloaded & verified its authnicity lets install it!

sudo apt update
sudo apt install nginx

Useful Commands

That’s it! You have now installed the latest release of Nginx. You should now start it and make it start on reboot.sudo systemctl start nginx.service
sudo systemctl enable nginx.service

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

To restart or stop nginx:

sudo systemctl stop nginx.service
sudo systemctl restart nginx.service

Setup Your Website

You should now verify that nginx has started and is correctly installed by visiting it. Http://YourServerIp. If everything is correctly setup you should see something like this:

Image result for welcome to nginx
The default index page for nginx.

Your website configuration is located at/etc/nginx/conf.d/default.conf
Your website HTML files are located at/usr/share/nginx/html

Now what?

Well now you can upload your own files or install wordpress as shown here

Add comment