参考网站: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-server php-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、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com