gpt4 book ai didi

php - nginx fpm gzip压缩不起作用

转载 作者:行者123 更新时间:2023-12-04 19:20:04 25 4
gpt4 key购买 nike

我已经用 php-fpm + opcache 配置了 nginx(可能是 opcache 是问题,但我对此表示怀疑)。
所以:

cat /etc/nginx/conf.d/gzip.conf
gzip on;
gzip_proxied any;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
gzip_vary on;
gzip_disable "msie6";

phpinfo() 输出:
Phar
Phar: PHP Archive support enabled
Phar EXT version 2.0.1
Phar API version 1.1.1
SVN revision $Id: ec8e5fbde7521bb0b03975e5c086f4e10830b36f $
Phar-based phar archives enabled
Tar-based phar archives enabled
ZIP-based phar archives enabled
gzip compression enabled
bzip2 compression enabled
OpenSSL support enabled

Firebug 响应 header :
Connection  Keep-Alive
Content-Type application/json;charset=utf-8
Date Wed, 16 Apr 2014 09:37:54 GMT
Proxy-Connection Keep-Alive
Server nginx/1.4.1 (Ubuntu)
Transfer-Encoding chunked
Vary Accept-Encoding
Via 1.1 MSFWX
x-powered-by PHP/5.5.3-1ubuntu2.2

PS application/json 由 headers 和 gzip_types 支持,我的猜测是 opcache 模块(最近启用,在那一刻 gzip 停止运行之后)因为将 php 代码的编译位放入 RAM 而从不 gzip 它。我应该通过 ob_start("ob_gzhandler") 压缩它吗?现在?

最佳答案

好的,现在它运行良好。
解决方案:这是因为 fpm 模块 - 你需要 1st

kill -9 <every fpm process> 

接着
service php5-fpm restart

PS在系统上测试
PHP 5.5.3-1ubuntu2.2 (cli) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies

我希望这会对某人有所帮助。

关于php - nginx fpm gzip压缩不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23106034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com