centos6.6 下 安装 php7 + nginx环境的方法
本文实例讲述了centos6.6下安装php7+nginx环境的方法。分享给大家供大家参考,具体如下:
1、安装必要的依赖库
>yum-yinstallgdzliblibjpeglibjpeg-devellibpnglibpng-develfreetypefreetype-devellibxml2libxml2-developensslopenssl-develcurl-devellibxslt-devel
2、下载php源码包
http://php.net/downloads.php
文件名为:php-7.0.4.tar.gz
3、解压源码包
>tar-zxvfphp-7.0.4.tar.gz
4、进入目录,并configure
./configure--prefix=/data/nmp/php\ --with-curl\ --with-freetype-dir\ --with-gd\ --with-gettext\ --with-iconv-dir\ --with-kerberos\ --with-libdir=lib\ --with-libxml-dir\ --with-mysqli=mysqlnd\ --with-openssl\ --with-pcre-regex\ --with-pdo-mysql=mysqlnd\ --with-pdo-sqlite\ --with-pear\ --with-png-dir\ --with-xmlrpc\ --with-xsl\ --with-zlib\ --enable-mysqlnd\ --enable-fpm\ --enable-bcmath\ --enable-libxml\ --enable-inline-optimization\ --enable-gd-native-ttf\ --enable-mbregex\ --enable-mbstring\ --enable-opcache\ --enable-pcntl\ --enable-shmop\ --enable-soap\ --enable-sockets\ --enable-sysvsem\ --enable-xml\ --enable-zip\ --enable-pthreads\ --enable-maintainer-zts\ --enable-fileinfo
5、make&&makeinstall
>make&&makeinstall
6、配置文件
>cpphp.ini-development/data/nmp/php/lib/php.ini >cp/data/nmp/php/etc/php-fpm.conf.default/data/nmp/php/etc/php-fpm.conf >cp/data/nmp/php/etc/php-fpm.d/www.conf.default/data/nmp/php/etc/php-fpm.d/www.conf >cp-R./sapi/fpm/php-fpm/data/nmp/php/etc/init.d/php-fpm
(*需要创建init.d目录)
7、启动
>/data/nmp/php/etc/init.d/php-fpm
8、nginx整合php
>vi/data/nmp/nginx/conf/nginx.conf server{ listen80; server_namelocalhost; charsetutf-8; #root网站的目录 location/{ root/data/wwwroot; indexindex.htmlindex.htmindex.php; } location~\.php${ #网站目录 root/data/wwwroot; #phpcgi端口,默认9000 fastcgi_pass127.0.0.1:9000; fastcgi_indexindex.php; #document_root指向的就是网站目录 fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name; includefastcgi_params; } }
9、重新加载nginx
>/data/nmp/nginx/sbin/nginx-sreload
希望本文所述对大家centos环境配置有所帮助。
声明:本文内容来源于网络,版权归原作者所有,内容由互联网用户自发贡献自行上传,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任。如果您发现有涉嫌版权的内容,欢迎发送邮件至:czq8825#qq.com(发邮件时,请将#更换为@)进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。