视频的容积 发表于 2015-11-16 11:56:24

Centos6 yum搭建Linux+Nginx+PHP+MYSQL(LNMP)

  参考网站:http://www.ppkj.net/2011/11/18/centos6-yum-%E6%90%AD%E5%BB%BAlinux-nginx-php-mysql-lnmp/
  


  


Centos6 yum搭建Linux+Nginx+PHP+MYSQL(LNMP)


最近接手维护一Linux服务器,Centos6版本,客户想要从Apache转换为Nginx.同时升级PHP到最新版本

如下操作配置Nginx1.0.10+PHP5.3.8(fastcgi)+Mysql5.5.17+eAccelerator(相关版本号是源软件包的最新版本)

使用Nginx官方源,Epel扩展库和remi源,remi源基于epel,必须先安装epel源,remi包含php-fpm,mysql-server5.5,如果只需要php-fpm可以单独安装php-fpm后禁用此源.

安装Nginx源:


rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm


安装EPEL源:


(64位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
(32位系统) rpm -ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm


安装REMI源:


rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm


开启REMI,编辑 /etc/yum.repos.d/remi.repo


vi /etc/yum.repos.d/remi.repo
修改 enable=1
esc
:wq


yum -y install nginx mysql-serverphp-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator


1.根据需求配置 nginx配置文件 (本博文不提供具体配置)

2.修改/etc/php-fpm.conf 用户组为nginx

3.修改/var/lib/php/session(使php能保存session),web用户组为nginx



chown -R nginx:nginx /var/lib/php/session(不存在则需要创建)

chown -R nginx:nginx /var/www/(web目录)

chmod -R 775 /var/www/ (同组可修改权限,方便配置ftp,ftp应该加入到nginx组,如果需要更高的安全设置,则不应当将只读的目录赋予nginx,php组可写权限)

service nginx start(start|stop|restart|reload)

service php-fpm start(start|stop|restart)

service mysqld start(start|stop|restart|reload)

设置自启动

chkconfig nginx on

chkconfig php-fpm on

chkconfig mysqld on


Tags: centos, centos6, lnmp, nginx, yum

This
entry was posted on 星期五, 十一月 18th, 2011 at 下午 2:04 and is filed under CentOS&Redhat, Linux, Nginx.
You can follow any responses to this entry through the RSS
2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.


« selinux
导致zendoptimizer无法启动解决
PHP版本的选择(转) »


  
页: [1]
查看完整版本: Centos6 yum搭建Linux+Nginx+PHP+MYSQL(LNMP)