尝试显示大型JSON时,Nginx Net :: ERR_INCOMPLETE_CHUNKED_ENCODING

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

“/ var / lib / nginx / fastcgi / 1/00/0000000001”失败(13:权限被拒绝)

在我的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也工作forms万维网数据

/ 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的内存限制是512M,nginx的机身限制是100m

服务器运行使用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;