Install nginx in CentOS 6


2013-04-20

I recently got a very inexpensive VPS. In fact it was so cheap, they didn't even offer my a choice of linux distros. Apparently, you can have any distro you want, as long as it's CentOS. Coming from an Ubuntu/Debian background, I had a little bit to learn. One lesson was how to install the nginx web server.

To install nginx, you will need to add a .repo file for the nginx repo. To do that create a file, as root, in /etc/yum.repos.d called nginx.repo:

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

and put this text in it:

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

Then you can install nginx with this command:

yum install nginx

And that's it. That's how you install nginx in CentOS 6.