Atlantic.Net Blog

How to Install Nginx on Debian 8.2 Cloud Server

Verified and Tested 09/05/15

Introduction

This how-to will help you with your Debian 8.2 installation so that you can successfully run a great performance based web server while easing the load on your system resources.Nginx is a powerful web server software that can be used on your server. It is also known for its high performance and low memory usage that will allow fewer resources to be used but still getting the job done efficiently.

Prerequisites

You need a Debian 8.2 server that is configured with a static IP address. If you do not have a server already, fire up a flexible and reliable virtual private server in under 30 seconds.

Server Preparation

To get started, login to your Debian 8.2 via SSH or the VNC Console though the Atlantic.Net Cloud Portal. Atlantic.Net Cloud servers are setup as minimal installations to avoid having unnecessary packages installed and never used.  Let’s make sure that your server is fully up-to-date.

apt-get update

With the server up-to-date, we can continue the installation process of your server.

Install Nginx

To install Nginx, we will need to use the apt-get  command so we can install the software:

sudo apt-get install nginx

You will now have NGINX installed on your server and can be verified typing in the following with your IP ADDRESS on your browser (http://YOUR.IP.ADD.RESS )

Your IP can be retrieved from the server with following command:

ifconfig eth0 | grep inet | awk '{ print $2 }'
This is the default page after installing Nginx on a Debian 8 Server

This image is the default page after installing Nginx on a Debian 8.2 Server

 

Configure Nginx (Single Host)

We will now configure Nginx by opening the central configuration file and editing the server_name line with your domain.

nano /etc/nginx/sites-available/default
This is the configuration file after Nginx has been installed on a Debian 8 server

This image is the configuration file after Nginx has been installed on a Debian 8.2 server

Save the file and restart the Nginx service so the changes take effect.

service nginx restart

Now you can create/upload your web content to the HTML directory of Nginx (Remember to replace the existing index.html file with your index.html which is your home page)

nano /var/www/html/index.html
nano /var/www/html/page1.html
nano /var/www/html/page2.html

What Next?

You now have your Debian 8.2 server with Nginx installed, you may now begin building high-performance websites using your newly installed web server. Thank you for following along and feel free to check back with us for further updates.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year