Just like our how to install NGINX on Debian VPS tutorial, installing on CentOS is just as easy.
First, we create /etc/yum.repos.d/nginx.repo and put in the following:
Next, we update our yum repos with yum update and install nginx with yum install nginx
Our nginx webserver is serving up files from /usr/share/nginx/html
A common problem is if your VPS has IPv6 that nginx will have issues. You resolve this by compiling nginx from source and enabling IPv6 support. Nginx packages, both Debian and CentOS in my experience, act funny and cause headache when IPv6 is not enabled even if you use it or not.
If you are looking for an nginx CentOS installation tutorial, Rob has already wrote one.
nginx (“engine x”) is a webserver and reverse proxy actively developed by Russian programmer Igor Sysoev and his development team. nginx, by comparison, has a small market share compared to Apache and Microsoft’s IIS however nginx’s popularity is increasing. Many large websites, such as Hulu, WordPress, Netflix, and others, have all moved from Apache to nginx citing nginx’s stability, speed and ability to handle the smallest website to the largest, high traffic websites without investing heavily in infrastructure like Apache who is a notorious resource hog.
First, we download and install the nginx signing key:
sudo apt-key add nginx_signing.key
Installation for Debian is relatively easy. We need to add these lines to your /etc/apt/sources.list:
deb http://nginx.org/packages/debian/ squeeze nginx
deb-src http://nginx.org/packages/debian/ squeeze nginx
Now, we update our apt packages and install nginx packages:
apt-get install nginx
nginx is running and the default nginx directory is /usr/share/nginx/html/
This is a basic guide about how to install nginx. This is just a webserver running, with no PHP support, and can serve up a static file website of HTML files, images or other content but cannot run PHP files since PHP is not installed. I will write up a tutorial about how to install PHP support and configure nginx.
Nginx is a popular lightweight alternative to Apache. Installing it with the yum package manager is simple:
# yum update
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/x86_64/epel-release-5-4.noarch.rpm
# yum install nginx
# /etc/init.d/nginx start
Check if Nginx is running at: http://xx.xx.xx.xx – You should see a default Nginx page.
Set Nginx to start automatically in case of reboot:
# /sbin/chkconfig nginx on
For more information, see: http://wiki.nginx.org
This article is also available in the VPS6.NET Knowledgebase: