gpt4 book ai didi

php - Nginx Net::ERR_INCOMPLETE_CHUNKED_ENCODING 试图显示大 JSON

转载 作者:行者123 更新时间:2023-12-02 18:16:31 25 4
gpt4 key购买 nike

你好,我正在尝试使用 php 显示大型 json,但是当 JSON 文件很大时,我得到 Net::ERR_INCOMPLETE_CHUNKED_ENCODING 并查看

"/var/lib/nginx/fastcgi/1/00/0000000001" failed (13: Permission denied) while reading upstream

在我的 nginx 日志中。

我的 nginx 服务器从 www-data 用户启动。

ps aux | grep nginx
root 1 0.0 0.0 95592 8872 ? Ss 12:08 0:00 nginx: master process nginx -g daemon off;
www-data 7 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 8 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 9 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 10 0.0 0.0 95960 5600 ? S 12:08 0:00 nginx: worker process
www-data 11 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 12 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 13 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 14 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 15 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 16 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 17 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 18 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 19 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 20 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 21 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 22 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 23 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 24 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 25 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 26 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 27 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 28 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 29 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 30 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 31 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 32 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 33 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 34 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 35 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 36 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 37 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
www-data 38 0.0 0.0 95592 3868 ? S 12:08 0:00 nginx: worker process
root 55 0.0 0.0 8868 776 ? S+ 12:14 0:00 grep --color=auto nginx

我的 php-fpm7 也可以在 www-data 上工作

/var/lib/nginx/也归 www-data 所有。

ls -l  nginx
total 20
drwxrwxrwx 2 www-data www-data 4096 Aug 21 21:35 body
drwxrwxrwx 2 www-data www-data 4096 Aug 21 21:35 fastcgi
drwxrwxrwx 2 www-data www-data 4096 Aug 21 21:35 proxy
drwxrwxrwx 2 www-data www-data 4096 Aug 21 21:35 scgi
drwxrwxrwx 2 www-data www-data 4096 Aug 21 21:35 uwsgi

php内存限制为512mnginx body 限制为 100m

服务器运行 usign docker。

我的 nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
worker_connections 1024;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
client_max_body_size 100m;
types_hash_max_size 2048;
server_tokens off;

server_names_hash_bucket_size 64;
server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;

gzip on;
gzip_disable "MSIE [1-6].(?!.*SV1)";

gzip_vary on;
gzip_proxied any;
gzip_min_length 1000;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}

stat 命令的输出

stat /var/lib/nginx/fastcgi
File: '/var/lib/nginx/fastcgi'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 40h/64d Inode: 140 Links: 2
Access: (0777/drwxrwxrwx) Uid: ( 1000/www-data) Gid: ( 33/www-data)
Access: 2016-08-30 11:30:16.268311861 +0000
Modify: 2016-08-21 21:35:34.000000000 +0000
Change: 2016-08-30 11:19:47.711701034 +0000
Birth: -

有什么问题吗?

最佳答案

最后通过删除/var/lib/nginx/fastcgi 目录然后从根目录重新创建它并将它的所有者更改为 www-data 来修复。

现在看起来是这样

drwxr-xr-x 2 www-data root     4096 Sep  5 13:58 fastcgi

也可以通过使用这些配置设置调整 fastcgi 缓冲区大小来解决此问题:

    fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;

关于php - Nginx Net::ERR_INCOMPLETE_CHUNKED_ENCODING 试图显示大 JSON,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39227306/

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