Thursday, June 14, 2012

Install Nginx On CentOS 5.5


Installing Nginx

Nginx is not available in the official CentOS repositories, but there's a package for CentOS 5.x in the centos.karan.org testing repository. We enable the repository as follows:
cd /etc/yum.repos.d/
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo
Next we open /etc/yum.repos.d/kbsingh-CentOS-Extras.repo ...
vi /etc/yum.repos.d/kbsingh-CentOS-Extras.repo
... and set gpgcheck to 0 and enabled to 1 in the [kbs-CentOS-Testing] section:
[...]
# pkgs in the -Testing repo are not gpg signed
[kbs-CentOS-Testing]
name=CentOS.Karan.Org-EL$releasever - Testing
gpgcheck=0
gpgkey=http://centos.karan.org/RPM-GPG-KEY-karan.org.txt
enabled=1
baseurl=http://centos.karan.org/el$releasever/extras/testing/$basearch/RPMS/
Afterwards we can install nginx as follows:
yum install nginx
Then we create the system startup links for nginx and start it:
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
Type in your web server's IP address or hostname into a browser (e.g. http://192.168.0.100), and you should see a blank page (it is blank because/usr/share/nginx/html/index.html is empty; nevertheless nginx is working because otherwise it would not have delivered this blank page):

No comments: