centos6.6 下 安装 php7 + nginx环境的方法
2020-04-08 12:07
706 查看
本文实例讲述了centos6.6 下 安装 php7 + nginx环境的方法。分享给大家供大家参考,具体如下:
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
(*需要创建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网站的目录 location / { root /data/wwwroot; index index.html index.htm index.php; } location ~ \.php$ { #网站目录 root /data/wwwroot; #phpcgi端口,默认9000 fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; #document_root指向的就是网站目录 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
9、重新加载nginx
> /data/nmp/nginx/sbin/nginx -s reload
希望本文所述对大家centos环境配置有所帮助。
您可能感兴趣的文章:
- Centos 安装 PHP7.4 和 Nginx的操作方法
- centos7利用yum安装lnmp的教程(linux+nginx+php7.1+mysql5.7)
- 详解如何在CentOS7中使用Nginx和PHP7-FPM安装Nextcloud
- CentOS 7.2 下编译安装PHP7.0.10+MySQL5.7.14+Nginx1.10.1的方法详解(mini版本)
- CentOS 7.3.1611编译安装Nginx1.10.3+MySQL5.7.16+PHP7.1.2
- CentOS 7.2.1511 编译安装Nginx1.10.1+MySQL5.7.14+PHP7.0.11
- Centos7 安装 PHP7最新版的详细教程
- CentOS 7下部署php7.1和开启MySQL扩展的方法教程
- CentOS下PHP7的编译安装及MySQL的支持和一些常见问题的解决办法
相关文章推荐
- CentOS 6.x 7.x yum安装nginx1.12-php7-mysql5.7环境
- centos6.6 下 安装 php7 按 nginx方式
- CentOS6.6环境中安装Nginx详细过程笔记
- LNMP, CentOS7.0+Nginx+Mysql5.7+PHP7环境安装
- centos7 nginx配置httpsCenos(6.6/7.1)下从源码安装Python+Django+uwsgi+nginx环境部署(二)
- centos安装nginx+mysql+php+fastcgi+memcache最简单方法
- centos 6.6下安装nginx
- CentOS5.5 Nginx环境搭建(源码方式安装)
- CentOS6.6 32位 Minimal版本纯编译安装Nginx Mysql PHP Memcached
- CentOS 6.6下的J2EE环境搭建(五)之MySQL安装
- CentOS 6.6 安装 nginx
- 在虚拟机(CentOS)中搭建LAMP开发环境2--[安装Nginx]
- CentOS 7.0编译安装Nginx1.6.0+MySQL5.6.19+PHP5.5.14方法分享
- VMware 11环境下基于ISO映像安装CentOS 6.6 操作系统
- centos6.6编译安装nginx-1.8.0
- 最小化安装CentOS7 + xfce4 +PHP + nginx +mariadb 开发环境
- 阿里云服务器CentOS 6.3下快速安装部署 LAMP 、vsftpd 环境的方法
- centos6.6+django+nginx+uwsgi环境配置
- centos安装nginx+mysql+php+fastcgi+memcache最简单方法