您的位置:首页 > 其它

lnmp

2016-07-03 16:18 363 查看
1、操作系统

CentOSrelease6.5(final)

2、安装mysql

#yuminstallmysql-server

#vi/etc/my.cnf+default-character-set=utf8

#chkconfig--addmysqldchkconfig--level35mysqldon//开机启动查看#chkconfig--list|grepmysql*

#servicemysqldstop//停止restart//重启start//启动

#mysqladmin-urootpassword123456//设置管理员密码

#UPDATEuserSET`Host`='%'WHERE`User`='root'LIMIT1;FLUSHPRIVILEGES;//所有主机root连接

#vi/etc/sysconfig/iptables

增加:-AINPUT-mstate--stateNEW-mtcp-ptcp--dport3306-jACCEPT

#serviceiptablesrestart

3、安装nginx

先安装nginx的yum源
http://nginx.org/en/linux_packages.html#stable找到链接,安装:

#rpm-ivhhttp://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
查看:

#yuminfonginx

安装:

#yuminstallnginx

#servicenginxstart

默认配置:/etc/nginx/conf.d/

4、安装php

#wgethttp://cn2.php.net/get/php-5.6.23.tar.gz/from/this/mirror

#tar–zxvfphp-5.6.23.tar.gz

#yuminstallepel-release

或者

#rpm-Uvh'target='_blank'>http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm[/code]
#yuminstallgccbisonbison-develzlib-devellibmcrypt-develmcryptmhash-developenssl-devellibxml2-devellibcurl-develbzip2-develreadline-devellibedit-develsqlite-devellibpng-devel

#cdphp-5.6.23

#./configure\

--prefix=/usr/local/php56\

--with-config-file-path=/usr/local/php56/etc\

--enable-inline-optimization\

--disable-debug\

--disable-rpath\

--enable-shared\

--enable-opcache\

--enable-fpm\

--with-fpm-user=nginx\

--with-fpm-group=nginx\

--with-mysql=mysqlnd\

--with-mysqli=mysqlnd\

--with-pdo-mysql=mysqlnd\

--with-gettext\

--enable-mbstring\

--with-iconv\

--with-mcrypt\

--with-mhash\

--with-openssl\

--enable-bcmath\

--enable-soap\

--with-libxml-dir\

--enable-pcntl\

--enable-shmop\

--enable-sysvmsg\

--enable-sysvsem\

--enable-sysvshm\

--enable-sockets\

--with-curl\

--with-zlib\

--enable-zip\

--with-bz2\

--with-gd\

--with-freetype\

--with-readline

#make-j8

#makeinstall


配置PHP


配置文件:


#cpphp.ini-development/usr/local/php56/etc/php.ini

php-fpm服务


#cp/usr/local/php56/etc/php-fpm.conf.default/usr/local/php56/etc/php-fpm.conf

#cpsapi/fpm/init.d.php-fpm/etc/init.d/php-fpm56

#chmod+x/etc/init.d/php-fpm56

启动php-fpm


#servicephp-fpm56start

Startingphp-fpmdone

php-fpm可用参数start|stop|force-quit|restart|reload|status


添加PHP命令到环境变量


编辑~/.bash_profile,将:


PATH=$PATH:$HOME/bin

改为:

PATH=$PATH:$HOME/bin:/usr/local/php56/bin

使PHP环境变量生效:


#.~/.bash_profile

查看看PHP版本


#php-v


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: