Jan 26

installing nginx + php-fpm using centos.alt.ru & EPEL repo

I have create post about installing nginx + php-fpm from source before in here http://adityo.blog.binusian.org/?p=428. In this tutorial i will create a more simple way installing nginx + php-fpm using yum with centos.alt.ru & EPEL repo.

Here it’s goes:

– Create repo
# cd /etc/yum.repos.d
# vim rusia-repo.repo

– and paste this

[rusia-repo]
name=CentOS-$releasever – rusia packages for $basearch
#baseurl=file:///raid/RH/CentOS/$releasever/local/$basearch
baseurl=http://centos.alt.ru/pub/repository/centos/5/i386/
enabled=1
gpgcheck=0
protect=1

– Enable EPEL repo
# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/$(uname -m)/epel-release-5-3.noarch.rpm

– Install nginx and php-fpm

# yum install nginx php-fpm

– you will see this package
================================================================================
Package         Arch        Version                      Repository       Size
================================================================================
Installing:
nginx               x86_64      0.6.39-2.el5                 epel            319 k
nginx               i386        0.8.32-1.el5                 rusia-repo      393 k
php-fpm         i386        5.3.1-2.el5                  rusia-repo      1.2 M
Installing for dependencies:
bzip2-libs      i386        1.0.3-4.el5_2                base             37 k
db4                  i386        4.3.29-10.el5                base            909 k
gdbm              i386        1.8.0-26.2.1                 base             27 k
gmp                 i386        4.1.4-10.el5                 base            664 k
libedit            i386        2.11-2.20080712cvs.el5       epel             79 k
libevent        i386        1.4.12-1.el5                 rusia-repo      128 k
libxml2         i386        2.6.26-2.1.2.8               base            795 k
pcre                i386        6.6-2.el5_1.7                base            112 k
perl                 i386        4:5.8.8-27.el5               extras           12 M
php-common      i386        5.3.1-2.el5                  rusia-repo      553 k

Transaction Summary
================================================================================
Install     13 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 17 M)
Remove       0 Package(s)

Total download size: 7.4 M

– go to nginx configuration file: “/usr/local/nginx/conf/nginx.conf” , and add  the php configuration

location ~ \.php$ {
root /usr/share/nginx/html; # itmena the root of the coument are located on

/usr/share/nginx/html
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

– Go to /usr/share/nginx/html and create php files
# vi index.php
<?php phpinfo(); ?>

– Start the nginx and php-fpm
# service php-fpm start
# service nginx start

You can go to your server domain / ip address to see the phpinfo files