Home » How to Install Nginx in Ubuntu

How to Install Nginx in Ubuntu

by Online Tutorials Library

How to install NGINX on Ubuntu 16.04 LTS?

Introduction

Nginx is an open source HTTP web server. It was created by Igor Sysoev and released on 2004. we can use it to deploy web applications.

In this tutorial, we are installing it over the Ubuntu operating system.

Prerequisites

  • Ubuntu
  • Terminal sudo login

Nginx Installation

Installation process is pretty easy, it requires just single line of command. The following command is used for installation.

Software NGINX 1

After installation, we can access it using browser by typing localhost and it will display the following output.

Software NGINX 2

Well, we have installed it successfully on the Ubuntu operating system.

Manage Nginx Server

The following commands are used to manage server tasks like stop, start etc.

Start Nginx

Use following command to start nginx server.

Stop Nginx

Use following command to stop nginx server.

Restart Nginx

Use following command to restart nginx server.

Status of Nginx

Use following command to check status of nginx server.

Software NGINX 3

Reload Nginx

If we make changes to the server configuration, simply reload the nginx without dropping connection. Use the following command to reload the server.

Disable Nginx at Booting Time

By default, Nginx is enable at booting time and starts automatically. If we want to disable it, use the following command.

Software NGINX 4

Enable Nginx at Booting Time

If we want to start Nginx server automatically at boot time, use the following command.

Software NGINX 5


Extra Info

/var/www/html/ is a server root directory.

/etc/nginx/ is a configuration directory.

/var/log/nginx/access.log is a server log file that contains records of all request.

/var/log/nginx/error.log is a server error log file that contains error records.

You may also like