How To Install Nginx On CentOS 5/6/7 and Ubuntu
Linux Web Servers

How To Install Nginx On CentOS 5/6/7 and Ubuntu server

Before Getting Start, Know About Nginx

Nginx is the world second most in use web servers/application in the world and uses most with the site which has higher web traffic sites of the world on the internet. Nginx is very much resource friendly web server application. Also, sometimes Nginx is used s a web server or a reverse proxy. Let’s install Nginx

In this tutorial, we’ll discuss how to get Nginx installed on your centOS 5/6/7 Ubuntu 14.04 server.

Step 1: Install EPEL Repository

EPEL stands for Extra Packages for Enterprise Linux. Because yum as a package manager does not include the latest version of Nginx in its default repository, installing EPEL will make sure that Nginx on CentOS stays up to date.
For CentOS 5/6/7 install EPEL, open terminal and type in:

Note: We don’t require and action to do for Ubuntu as Ubuntu team provides Nginx package in its default repositories

Step 2: Install Nginx

To install Nginx on Centos, open terminal and type in:

For CentOS

After you answer yes to the prompt twice (the first time relates to importing the EPEL gpg-key), Nginx will finish installing on your virtual private server.

For Ubuntu



Step 3: Start Nginx

Nginx does not start on its own. To get Nginx running, type:

On Centos

On Ubuntu

Service will start Automatically.

Now, you can confirm that Nginx has installed on your Server/VPS by directing your browser to your IP address. You can run the following command to reveal your server’s IP address.

For CentOs

For Ubuntu

Step 4: Check Nginx

On the page, you will see the words, “Welcome to Nginx”
Congratulations! You have now installed Nginx.

Nginx Welcome Screen | kapenra.com

Note : Default Nginx Installation Directory is /usr/share/nginx

Few Management Command For Nginx Process

To stop your Nginx:

To start Nginx, type:

To restart the service again, type:

Note: Management command for CentOs and Ubuntu are same.

To Restart automatically when the server is rebooted:

For Ubuntu

This should already be enabled by default, so you may see a message like this:
System start/stop links for /etc/init.d/nginx already exist.

For CentOS

 


Watch Video: And Subscribe To My YouTube Channel

Subscribe on Youtube

In case, if you are having anyone trouble in this tut please let me know by commenting and please share this article with your friends.

You May LIke to read:

Read How to Configure nginx with PHP in /var/www/html Directory

Kapendra
Love to write technical stuff with personal experience as I am working as a Sr. Linux Admin. and every day is a learning day and Trust me being tech geek is really cool.
http://kapendra.com

Leave a Reply