Install nginx on CentOS 6


Nginx is a high-performance web server specifically designed for delivering large amounts of static content. You can install nginx in CentOS 6 with the help of yum command.

Basic requirements

Get a server from Bytehouse Cloud Products and configure the server.

SSH to the server.

ssh username@your-server-ip

Install EPEL repo

$  sudo yum install epel-release

Install nginx

$ sudo yum install nginx

Start nginx service by executing the below command.

sudo service nginx start

Get your server IP address by executing the below command.

ifconfig | grep inet | awk '{print $2}'

In your browser enter the following URL

http://your-server-ip

Nginx default page will be displayed

The default document root of nginx is /usr/share/nginx/html. If you wish to change the default document root of nginx, edit the configuration file in /etc/nginx/conf.d/default.conf.

Change root parameter under location section in configuration file.

location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
}

You can check the status of nginx process by executing the below command.

-$  sudo service nginx status
    nginx (pid  11022) is running...
Last update:
2016-06-29 23:40
Author:
Bytehouse Technical Support
Revision:
1.3
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.

Records in this category

Tags

top