nginx php7提速,记要博客升级nginx和php7,以及优化处理

坊间传闻php7提速很多,于是就想升级php尝试下(之前是5.4的)。因为nginx的版本也有点旧,之前是1.5的,琢磨着也一起升级下。一、升级nginx:官网下载地址:https://nginx.org/en/download.html有三个版本:Mainline version -> 主干版本;Stable version -> 当前稳定版本; Legacy versions -> 历史稳定版本。我从历史稳定版本里下了nginx的1.8.1版本。类似之前安装nginx的步骤:http://www.webyang.net/Html/web/article_127.htmlconfigure时候,ngx_cache_purge-2.1报错。nginx1.8需要ngx_cache_purge-2.3版本支持。于是从http://labs.frickle.com/files下载 ngx_cache_purge-2.3。重新configure:./configure --prefix=/usr/local/nginxnew --sbin-path=/usr/local/nginxnew/sbin/nginx --conf-path=/usr/local/nginxnew/conf/nginx.conf --error-log-path=/usr/local/nginxnew/log/error.log --http-log-path=/usr/local/nginxnew/log/access.log --pid-path=/usr/local/nginxnew/run/nginx.pid    --user=www --group=www --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/usr/local/nginxnew/tmp/client --http-proxy-temp-path=/usr/local/nginxnew/tmp/proxy/ --http-fastcgi-temp-path=/usr/local/nginxnew/tmp/fcgi/ --add-module=../ngx_cache_purge-2.3 --with-pcre=../pcre-8.34我保留了两套nginx,所以新编译的目录是nginxnewmake && make install一路顺畅。运行:/usr/local/nginx/sbin/nginxnginx: [emerg] mkdir() "/usr/local/nginxnew/tmp/client" failed (2: No such file or directory)mkdir -p /usr/local/nginxnew/tmp/client把nginx.conf 的运行用户改下:user www。其他都不变。二、php升级:官网下载:http://php.net/downloads.php,我选的是7.0.28wget http://php.net/get/php-7.0.28.tar.gz/from/a/mirror安装参考:http://www.webyang.net/Html/web/article_129.html./configure --prefix=/usr/local/phpnew --with-config-file-path=/usr/local/phpnew/etc --with-mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml  --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt=/usr/local/mcrypt --with-gd  --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-pear   --enable-pdo --with-pdo-mysql --with-gettext --enable-exif --enable-wddx --enable-calendar --enable-ftp  --enable-dba --enable-sysvmsg  --enable-sysvshm --enable-debug --enable-maintainer-zts --enable-embed --with-pcre-regex --enable-gd-jis-conv --with-fpm-user=www --with-fpm-group=www --enable-socketsphp同样保留了两套,方便出问题来回切,所以新编译目录是phpnew/usr/local/phpnew/sbin/php-fpm 启动php-fpmERROR: failed to open configuration file '/usr/local/phpnew/etc/php-fpm.conf': No such file or directory (2)cp /usr/local/phpnew/etc/php-fpm.conf.default  /usr/local/phpnew/etc/php-fpm.conf注意php.ini默认没有,需要从源码中复制过来(源码我的在opt目录,production生产配置,develop开发配置)cp /opt/php-7.0.28/php.ini-production /usr/local/phpnew/etc/php.ini另外如果如果两套php-fpm都需要的话,这个就得改下端口。我的是php-fpm都在跑,所以新php-fpm改了端口,9001。至此升级完毕。升级php7后,很早的时候就看到php鸟哥的文章:http://www.laruence.com/2015/12/04/3086.html优化php7的方案:1、Opcachephp7默认安装了Opcache,只要开启就好:zend_extension=opcache.soopcache.enable=1opcache.enable_cli=12、gcc升级

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值