新聞中心
本文實例講述了centos6.6 下 安裝 PHP7 + nginx環(huán)境的方法。分享給大家供大家參考,具體如下:

創(chuàng)新互聯(lián)服務(wù)項目包括臨漳網(wǎng)站建設(shè)、臨漳網(wǎng)站制作、臨漳網(wǎng)頁制作以及臨漳網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,臨漳網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到臨漳省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
1、安裝必要的依賴庫
> yum -y install gd zlib libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel openssl openssl-devel curl-devel libxslt-devel
2、下載php源碼包
http://php.net/downloads.php
文件名為:php-7.0.4.tar.gz
3、解壓源碼包
> tar -zxvf php-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 && make install
> make && make install
6、配置文件
> cp php.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
(*需要創(chuàng)建init.d目錄)
7、啟動
> /data/nmp/php/etc/init.d/php-fpm
8、nginx整合php
> vi /data/nmp/nginx/conf/nginx.conf
server {
listen 80;
server_name localhost;
charset utf-8;
#root網(wǎng)站的目錄
location / {
root /data/wwwroot;
index index.html index.htm index.php;
}
location ~ \.php$ {
#網(wǎng)站目錄
root /data/wwwroot;
#phpcgi端口,默認9000
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#document_root指向的就是網(wǎng)站目錄
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
9、重新加載nginx
> /data/nmp/nginx/sbin/nginx -s reload
希望本文所述對大家centos環(huán)境配置有所幫助。
香港服務(wù)器選創(chuàng)新互聯(lián),2H2G首月10元開通。
創(chuàng)新互聯(lián)(www.cdcxhl.com)互聯(lián)網(wǎng)服務(wù)提供商,擁有超過10年的服務(wù)器租用、服務(wù)器托管、云服務(wù)器、虛擬主機、網(wǎng)站系統(tǒng)開發(fā)經(jīng)驗。專業(yè)提供云主機、虛擬主機、域名注冊、VPS主機、云服務(wù)器、香港云服務(wù)器、免備案服務(wù)器等。
本文標題:centos6.6下安裝php7+nginx環(huán)境的方法
網(wǎng)站網(wǎng)址:http://www.dlmjj.cn/article/cdispci.html


咨詢
建站咨詢
