centos6.6 下 安裝 php7 + nginx環(huán)境的方法
本文實(shí)例講述了centos6.6 下 安裝 php7 + nginx環(huán)境的方法。分享給大家供大家參考,具體如下:
1、安裝必要的依賴庫(kù)
> 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、進(jìn)入目錄,并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
(*需要?jiǎng)?chuàng)建init.d目錄)
7、啟動(dòng)
> /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端口,默認(rèn)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
希望本文所述對(duì)大家centos環(huán)境配置有所幫助。
- CentOS 8.1下搭建LEMP(Linux+Nginx+MySQL+PHP)環(huán)境(教程詳解)
- Centos 安裝 PHP7.4 和 Nginx的操作方法
- 解決thinkPHP 5 nginx 部署時(shí),只跳轉(zhuǎn)首頁(yè)的問(wèn)題
- 淺談thinkphp的nginx配置,以及重寫(xiě)隱藏index.php入口文件方法
- 詳解php+nginx 服務(wù)發(fā)生500 502錯(cuò)誤排查思路
- docker搭建php+nginx+swoole+mysql+redis環(huán)境的方法
- nginx+php出現(xiàn)No input file specified解決辦法
- Nginx+php配置文件及原理解析
相關(guān)文章
linux下查看內(nèi)存條數(shù)及每根內(nèi)存大小的實(shí)現(xiàn)方法(推薦)
下面小編就為大家?guī)?lái)一篇linux下查看內(nèi)存條數(shù)及每根內(nèi)存大小的實(shí)現(xiàn)方法(推薦)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-11-11Apache運(yùn)行模式之standalone和inetd模式介紹
這篇文章主要介紹了Apache運(yùn)行模式之standalone和inetd模式介紹,本文講解了ServerType這個(gè)配置參數(shù),ServerType這個(gè)配置選項(xiàng)指定如何運(yùn)行Apache,需要的朋友可以參考下2015-06-06詳解Linux 查看服務(wù)器開(kāi)放的端口號(hào)
本篇文章主要介紹詳解Linux 查看服務(wù)器開(kāi)放的端口號(hào),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-03-03centos7云主機(jī)系統(tǒng)下掛載磁盤(pán)的方法
本篇文章主要介紹了centos7云主機(jī)系統(tǒng)下掛載磁盤(pán)的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02Ubuntu系統(tǒng)網(wǎng)絡(luò)故障排查的方法
最近在使用Ubuntu系統(tǒng)的時(shí)候碰到一個(gè)問(wèn)題,連接無(wú)線網(wǎng)絡(luò)的時(shí)候,發(fā)現(xiàn)右上角網(wǎng)絡(luò)設(shè)置中沒(méi)有 Enable Wi-Fi 這個(gè)選項(xiàng)了,所以通過(guò)一步步排查,終于找了解決辦法,現(xiàn)在分享給大家,有需要的朋友們可以參考借鑒。2016-10-10改版時(shí)保留原鏈接,創(chuàng)建新的URL的方法
本功能的Alias指令在 httpd.conf中是這一句: #Alias /webpath /full/filesystem/path 去掉前面的#,并做下相應(yīng)的修改即可。2008-09-09通過(guò) SSH 在遠(yuǎn)程 Linux 系統(tǒng)上運(yùn)行命令的方法
這篇文章主要介紹了通過(guò) SSH 在遠(yuǎn)程 Linux 系統(tǒng)上運(yùn)行命令的方法,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-10-10