运维笔记:PHP+nginx编译安装参考

发布时间:2019-08-07 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了运维笔记:PHP+nginx编译安装参考脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

前言

由于很多新手问我怎么做编译安装,所以就蛮整理一下。学会编译安装,无论是开发或者运维,都是皆要掌握的硬性要求

PHP

依赖

yum install libXMl2-devel bzip2-devel libcurl-devel libpng-devel libxpm-devel libjPEg-turbo-devel gmp-devel freetype-devel libvpx-devel krb5-devel zlib-devel pcre-devel PAM-devel openssl openssl-devel libmcrypt libmcrypt-devel
libmcrypt libmcrypt-devel 可能不存在
需要添加repo 
yum install EPEL-release
yum install libmcrypt libmcrypt-devel

安装步骤参考

  • 下载包 wget http://php.net/get/php-7.2.5....
  • 拓展差异 php7.2 enable-gd-native-ttf wITh-mcrypt 已经不支持
  • 编译参数 酌情加减(可移步其他文章了解参数 PHP编译参数详解)
    ./configure --PRefix=/opt/php72 --with-config-file-scan-dir=/opt/php72/etc/php.d --disable-debug --with-pic --with-bz2 --with-gettext --with-gmp --enable-mbregex --enable-mbstring --with-openssl --with-zlib --with-layout=GNU --enable-exif --enable-zip --enable-sockets --enable-xML --with-pear --enable-FPM --with-pdo-MySQL --with-curl --with-gd --with-mySQLi --enable-SOAp --with-fpm-user=www --with-fpm-group=www --with-freetype-dir --enable-mbstring --enable-bcmath --with-jpeg-dir --with-ldap-dir

配置文件整理

cp php-fpm.conf.default php-fpm.conf
cp www.conf.default www.conf
cp php.ini-production /opt/php7/etc/php.ini 从码包复制php.ini配置

nginx

安装步骤参考

yum install gcc #编译需要
yum install -y pcre-devel #rewrite
yum install -y zlib-devel #HTTP gzip
yum install openssl* #支持ssl
wget http://nginx.org/download/ngi...
tar xvzf nginx-1.11.5.tar.gz
./configure --prefix=/opt/nginx --user=www --group=www --with-http_ssl_module --with-pcre
make && make install

常见编译参数说明

./configure --help
./configure
--prefix=/opt/nginx
--user=apache
--group=apache
--with-http_stub_status_module:支持nginx状态查询
--with-http_ssl_module:支持https
--with-http_spdy_module:支持GOOGLE的spdy,想了解请百度spdy,这个必须有ssl的支持
--with-pcre:为了支持rewrite重写功能,必须制定pcre

脚本宝典总结

以上是脚本宝典为你收集整理的运维笔记:PHP+nginx编译安装参考全部内容,希望文章能够帮你解决运维笔记:PHP+nginx编译安装参考所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。