Step by Step Tutorial – How To Install Nginx on CentOS 6

In this tutorial, I will explain how to install Nginx on a CentOS server / VPS. This is very easy and will not take more than 5 minutes.

Before starting installation of Nginx, make sure you have installed PHP and MySQL
How to install PHP
How to install MySQL

Login to your server via SSH and as root.

Step 1:

If you have already installed Apache and is running, stop Apache.

service httpd stop

Step 2:

Create nginx repo file.

touch /etc/yum.repos.d/nginx.repo

Step 3

Edit nginx repo file.

nano /etc/yum.repos.d/nginx.repo

And add following code. Save the file.

name=nginx repo

Step 4

Install Nginx

yum install nginx

Step 5

Start Nginx

service nginx start

Step 6

Make nginx auto start on server reboot.

sudo chkconfig nginx on


Default Web Directory

This is the default folder / directory of Nginx server. You should upload your website files in this directory.


Our Recommended VPS Hosting

1 Comment

  • Thank you for all your help, I found with this article I can install nginx with absolutely no problems of any 😀
    I am using CentOS 6 64bit
    whether running in 32 bit as well?

Leave us a Reply

Your email address will not be published. Required fields are marked *

* *