CentOS7 编译安装 nginx php7

2018-07-11 15:07:58 浏览数 (1)

腾讯云出了个学生优惠,可以每月1元使用云主机,买了一台。之前的VPS搭建LNMP环境一直用的是一键安装包oneinstack,想来自己也该编译玩玩,就没用一键安装包了。

安装 nginx

当前nginx的Stable version是1.8.0, Mainline version是1.9.9, 这里安装了1.9.9 下载的所有包都放在了/usr/local/src/

  1. 先把所需要的库下载安装好 zlib pcre openssl,

zlib http://zlib.net/zlib-1.2.8.tar.gz pcre http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-8.38.tar.gz openssl http://www.openssl.org/source/openssl-1.0.1j.tar.gz nginx http://nginx.org/download/nginx-1.9.9.tar.gz

  1. 编译安装 先把编译器安装一下 yum install gcc gcc-c zlib pcre openssl很简单,不用配置参数了, nginx我的编译参数是

./configure –with-http_v2_module –with-http_ssl_module –with-pcre=/usr/local/src/pcre-8.38 –with-zlib=/usr/local/src/zlib-1.2.8 –with-openssl=/usr/local/src/openssl-1.0.1j

安装 php7

PHP 7.0.0 Released也于2015年12月3日发布了, 反正也是自己的服务器用,不像企业级的要求那么高,就直接安装7了。

  1. 先把源码包下载 http://cn2.php.net/distributions/php-7.0.0.tar.gz
  2. 编译安装 php的编译,依赖的库比较多,编译时总是报错缺少一些库 软件,查到了一份资料,借来参考一下

yum install -y make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers php-mysqlnd libmcrypt-devel libtidy libtidy-devel recode recode-devel libxpm-devel

编译的参数

./configure –enable-mbstring –enable-zip –enable-bcmath –enable-pcntl –enable-ftp –enable-exif –enable-calendar –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-opcache –enable-fpm –enable-session –enable-sockets –enable-mbregex –with-fpm-user=vagrant –with-fpm-group=nogroup –enable-wddx –with-curl –with-mcrypt –with-iconv –with-gd –with-jpeg-dir=/usr –with-png-dir=/usr –with-zlib-dir=/usr –with-freetype-dir=/usr –enable-gd-native-ttf –enable-gd-jis-conv –with-openssl –with-pdo-mysql=mysqlnd –with-gettext=/usr –with-zlib=/usr –with-bz2=/usr –with-recode=/usr –with-xmlrpc –with-mysqli=mysqlnd

之后是php的配置了,也参考了上面的那篇文章,不再赘述了

0 人点赞