转自:http://junstar.blog.51cto.com/4551565/1677140
一.使用yum命令,安装所需的程序库
1.命令内容
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
二.安装Nginx
1.使用yum安装,命令为:
yum install -y nginx
如果出现如下错误:
请先安装epel:
1.使用命令:yum install -y epel-release
2.使用命令:rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
安装好epel后再安装nginx
2.验证是否安装成功,尝试启动nginx
service nginx start
三.安装PHP及若干扩展
1.使用yum安装php
yum install -y php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm
2.启动php-fpm
/etc/rc.d/init.d/php-fpm start
3.设置开机启动项
chkconfig php-fpm on
四.配置Nginx支持PHP
1.备份php-fpm的配置文件
cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak
2.修改配置文件
vim /etc/php-fpm.d/www.conf
#修改用户为nginx
user = nginx
#修改组为nginx
group = nginx
五.安装Mysql
1.使用yum直接安装mysql
yum -y install mysql mysql-server
2.启动Mysql,验证Mysql安装是否成功
service mysqld start