First, change the Yum source for NetEase to speed up the source
Vi/etc/yum.repos.d/centos-base.repo
Change content as follows
# Centos-base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The Mirror system uses the connecting IP address of the client and the
# Update status of each mirror to pick mirrors that is updated to and
# Geographically close to the client. You should the use of this for CentOS updates
# Unless you is manually picking other mirrors.
#
# If The mirrorlist= does not work for you, as a fall back to you can try the
# remarked out Baseurl= line instead.
#
#
[Base]
name=centos-$releasever-base
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=os
#baseurl =http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
Gpgcheck=1
Gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-5
#released Updates
[Updates]
name=centos-$releasever-updates
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=updates
#baseurl =http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
Gpgcheck=1
Gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-5
#packages used/produced in the build and not released
[Addons]
name=centos-$releasever-addons
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=addons
#baseurl =http://mirror.centos.org/centos/$releasever/addons/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/addons/$basearch/
Gpgcheck=1
Gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-5
#additional packages that could be useful
[Extras]
name=centos-$releasever-extras
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=extras
#baseurl =http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
Gpgcheck=1
Gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-5
#additional packages that extend functionality of existing packages
[Centosplus]
name=centos-$releasever-plus
#mirrorlist =http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=centosplus
#baseurl =http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=http://mirror.centos.org/centos/rpm-gpg-key-centos-5
Second, update yum
Yum-y Update
Third, install and upgrade the required libraries using the Yum command that comes with the CentOS Linux system
Lang=c
Yum-y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-deve L zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel Curl curl-devel e2fsprogs E2 Fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel openldap openldap-devel Nss_ldap Openldap-clients openldap-servers
Iv. Installing PHP and MySQL
yum-y install php mysql mysql-server mysql-devel php-mysql php-cgi php-mbstring php-gd php-fastcgi
Five, install Nginx
Since CentOS does not have a default Nginx package, you need to enable the Rehl attachment pack
RPM-UVH http://download.Fedora.RedHat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Yum-y Install Nginx
Set boot up
Chkconfig Nginx on
Six, install spawn-fcgi to run php-cgi
Yum Install spawn-fcgi
Vii. Download spawn-fcgi startup script
wget Http://bash.cyberciti.biz/dl/419.sh.zip
Unzip 419.sh.zip
MV 419.sh/etc/init.d/php_cgi
chmod +x/etc/init.d/php_cgi
Start php_cgi
/etc/init.d/php_cgi start
View process
NETSTAT-TULPN | grep:9000
If the following appears to represent all normal
TCP 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 4352/php-cgi
Eight, configuration nginx (detailed configuration see nginx.conf detailed instructions)
Location ~ \.php$ {
root 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;
}
Nine, view Phpinfo
Writing scripts
Phpinfo ();
X. Installation of phpMyAdmin
Permissions to modify/var/lib/php/session are consistent with Nginx and php_cgi
Chown-r www.www/var/lib/php/session
Details:http://www.myhack58.com/Article/sort099/sort0102/2011/29472.htm or http://ninghao.net/blog/1368
Yum install Nginx service on CentOS server