简体   繁体   English

无法加载资源:net :: ERR_INCOMPLETE_CHUNKED_ENCODING

[英]Failed to load resource: net::ERR_INCOMPLETE_CHUNKED_ENCODING

I've been having some problems with my application not loading the views (sometimes). 我的应用程序没有加载视图(有时)我遇到了一些问题。 I am running a Debian server with php-fpm and nginx (php5.6.8 and nginx 1.8.0) Both compiled from source. 我正在使用php-fpm和nginx(php5.6.8和nginx 1.8.0)运行Debian服务器。 On top of that I am running Lavavel 4.2. 最重要的是,我正在运行Lavavel 4.2。

So far I've had the problem in both Chrome and Firefox (chrome simply stops loading and shows the error, firefox does not show an error but shows a incomplete version of the view). 到目前为止,我已经在Chrome和Firefox中遇到了问题(chrome只是停止加载并显示错误,firefox没有显示错误但显示视图的不完整版本)。

So far I've checked the permissions of both nginx and PHP, they both run as the same user (www-data:www-data). 到目前为止,我已经检查了nginx和PHP的权限,它们都作为同一个用户运行(www-data:www-data)。 My php-fpm socket is configured as: 我的php-fpm套接字配置为:

[sitename]

listen = /var/run/php5-fpm/sitename.sock
listen.backlog = -1
listen.owner = www-data
listen.group = www-data
listen.mode=0660

; Unix user/group of processes
user = folderuser
group = www-data

; Choose how the process manager will control the number of child processes.
pm = dynamic
pm.max_children = 75
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.max_requests = 500

; Pass environment variables
env[HOSTNAME] = $HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp

Note that I set user to folderuser because the folder where the files for the site are located is owned by folderuser (folderuser:www-data). 请注意,我将user设置为folderuser,因为该站点的文件所在的文件夹由folderuser(folderuser:www-data)拥有。 Furthermore, permissions inside laravel folders are configured as 755 (775 for cache and upload folders so that www-data can write cache files) 此外,laravel文件夹中的权限配置为755(775用于缓存和上载文件夹,以便www-data可以写入缓存文件)

I have disabled any kind of serverside php cache (except for zend opcache). 我已禁用任何类型的服务器端PHP缓存(zend opcache除外)。

I've also tried disabling "prefetch resources to load pages more quickly" feature in chrome, which did not solve the problem. 我也尝试在chrome中禁用“预取资源以更快地加载页面”功能,但这并没有解决问题。

As a last resort I've tried this solution: 作为最后的手段,我尝试过这个解决方案:

/*
|--------------------------------------------------------------------------
| Fix for Chrome / PHP 5.4 issue
| http://laravel.io/forum/02-08-2014-another-problem-only-with-chrome
|--------------------------------------------------------------------------
*/

App::after(function($request, $response)
{

    $content = $response->getContent();

    $contentLength = strlen($content);

    $response->header('Content-Length', $contentLength);

});

And some variants to this script, but I got some content length mismatches (more often than the net::ERR_INCOMPLETE_CHUNKED_ENCODING errors. 以及此脚本的一些变体,但我得到了一些内容长度不匹配(比net::ERR_INCOMPLETE_CHUNKED_ENCODING错误更常见。

So to sum up, I've checked permissions and user/group settings serverside, I've disabled serverside caching (except for zend), I've messed around with chrome settings and I've tried a script for laravel, none of which solved the issue I am having. 总结一下,我已经检查了服务器端的权限和用户/组设置,我已经禁用了服务器端缓存(除了zend),我已经搞乱了chrome设置而且我已经尝试了一个laravel脚本,其中没有一个解决了我遇到的问题。 Note that the issue happens at random intervals at random pages on the site. 请注意,问题会在网站上的随机页面上随机发生。

I really do not know what the next step towards solving my problem would be as the solutions above are the only ones I've found on the internet. 我真的不知道解决我的问题的下一步是什么,因为上面的解决方案是我在互联网上找到的唯一解决方案。

I would really appreciate some help. 我真的很感激一些帮助。

Edit: I have a beta version of the same application running off another server with the exact same configuration (only difference is in hardware, more memory though), the issue does not present there. 编辑:我有一个相同的应用程序的测试版本运行另一台服务器具有完全相同的配置(只有硬件不同,但内存更多),问题不存在。

Also, I forgot the mention that the application does not run with HTTPS (currently). 此外,我忘了提到该应用程序不使用HTTPS(当前)运行。 The beta version however is running with HTTPS. 然而,测试版使用HTTPS运行。

Edit The server where the issue is present has 2048 MB RAM, the beta server has 8192 MB RAM. 编辑存在问题的服务器有2048 MB RAM,测试版服务器有8192 MB RAM。

Edit I inspected the response with fiddler when the error occured, it simply cuts of the response at some point for no reason. 编辑我在发生错误时用fiddler检查了响应,它只是在某个时刻无缘无故地切断了响应。

You might want to check if the folder /var/lib/nginx is owned by www-data too. 您可能想要检查文件夹/var/lib/nginx是否也归www-data I had this problem that, when the response page was too big, the Nginx worker process tried to use this folder and failed, because it was owned by nginx and the worker process ran under www-data . 我有这个问题,当响应页面太大时,Nginx工作进程尝试使用此文件夹并失败,因为它由nginx拥有,而工作进程在www-data下运行。 By doing chown -R www-data:www-data /var/lib/nginx , the problem was fixed. 通过chown -R www-data:www-data /var/lib/nginx ,问题得到解决。

I've seen a similar problem on my Nginx Server running on the latest Debian. 我在最新的Debian上运行的Nginx Server上看到了类似的问题。 I'm running a Wordpress site with Advanced Custom Fields installed. 我正在运行安装了高级自定义字段的Wordpress站点。 On the advanced custom fields it says that the problem could potentially be with the max_input_vars value in the php.ini file. 在高级自定义字段上,它表示问题可能与php.ini文件中的max_input_vars值有关。 I increased my value from 1000 to 3000 and that fixed the issue on one of my sites. 我将我的价值从1000增加到3000并修复了我的一个网站上的问题。

You can check out this link to see if it might help you. 您可以查看此链接,看看它是否对您有所帮助。 http://www.advancedcustomfields.com/faq/limit-number-fields/ http://www.advancedcustomfields.com/faq/limit-number-fields/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM