1.yum 安装 nginx
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm yum info nginx yum install niginx service nginx start
2.yum 安装 php5.5 php-fpm
## Remi Dependency on CentOS 6 ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum --enablerepo=remi,remi-php55 install nginx php-fpm php-common
yum --enablerepo=remi,remi-php55 install php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml
3.开机自动启动nginx,php-fpm
chkconfig --add nginx chkconfig --levels 235 nginx on chkconfig --add php-fpm chkconfig --levels 235 php-fpm on
参考:http://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/
centos上的卸载命令(以php为例)
rpm -qa|grep php
提示如下
#php-pdo-5.1.6-27.el5_5.3
#php-mysql-5.1.6-27.el5_5.3
#php-xml-5.1.6-27.el5_5.3
#php-cli-5.1.6-27.el5_5.3
#php-common-5.1.6-27.el5_5.3
#php-gd-5.1.6-27.el5_5.3
注意卸载要先卸载没有依赖的
pdo是mysql的依赖项;common是gd的依赖项;
例如:# rpm -e php-pdo-5.1.6-27.el5_5.3
error: Failed dependencies:
php-pdo is needed by (installed) php-mysql-5.1.6-27.el5_5.3.i386
所以正确的卸载顺序是:
rpm -e php-mysql-5.1.6-27.el5_5.3 rpm -e php-pdo-5.1.6-27.el5_5.3 rpm -e php-xml-5.1.6-27.el5_5.3 rpm -e php-cli-5.1.6-27.el5_5.3 rpm -e php-gd-5.1.6-27.el5_5.3 rpm -e php-common-5.1.6-27.el5_5.3
再用# php -v
查看版本信息已经没有提示