How to install nginx on centos

How can I install Nginx web server On CentOS Linux 6 or Red Hat? Nginx is faster at serving static files and consumes much less memory for concurrent requests because Nginx is event-based it doesn’t need to spawn new processes or threads for each request, so its memory usage is very low.

Add nginx yum repository

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

add this to Centos

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

add this if to RHEL

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/$releasever/$basearch/
gpgcheck=0
enabled=1

Install nginx web-server

yum install nginx

Sample outputs:

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
nginx i386 1.4.0-1.el6.ngx nginx 352 k

Transaction Summary
================================================================================
Install 1 Package(s)

Total download size: 352 k
Installed size: 741 k
Is this ok [y/N]: y
Downloading Packages:
nginx-1.4.0-1.el6.ngx.i386.rpm | 352 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : nginx-1.4.0-1.el6.ngx.i386 1/1
———————————————————————-

Thanks for using NGINX!

Check out our community web site:
* http://nginx.org/en/support.html

If you have questions about commercial support for NGINX please visit:
* http://www.nginx.com/support.html

———————————————————————-
Verifying : nginx-1.4.0-1.el6.ngx.i386 1/1

Installed:
nginx.i386 0:1.4.0-1.el6.ngx

Turn on nginx service

chkconfig nginx on

Start nginx server

service nginx start

Restart nginx server

service nginx restart

Stop nginx server

service nginx stop

Check nginx server status

service nginx status
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments