<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I have somme strange comportement on nginx 1.7.4  / Freebsd 9 : Some Wordpress microcached pages rendered ..EMPTY HTML pages , for about 1/20 visitors .<div>When it happens, we have to make a forced reload of the page on the navigator (Firefox or others).<br><div><br><div>configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx-error.log --user=www --group=www --with-file-aio --with-ipv6 --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx-access.log --add-module=/usr/ports/www/nginx-devel/work/ngx_cache_purge-2.1 --with-http_geoip_module --with-http_stub_status_module --with-pcre</div><div><br></div><div>sendfile(/cache/nginx/8/f2/fa48a21dcdf1f2a9ff3d8215b0ab4f28) returned busy again</div><div><br></div><div><br></div><div>nginx.conf</div><div><br></div><div>user  www;<br>worker_processes  4;<br>events {<br><span class="Apple-tab-span" style="white-space: pre;">   </span>worker_connections  2048;<br>      multi_accept on;<br>}<br><br>http {<br>  include       mime.types;<br>  default_type  application/octet-stream;<br><br>  fastcgi_cache_path /cache/nginx levels=1:2 keys_zone=microcache:5m max_size=1000m;<br>  fastcgi_cache_key "$scheme$request_method$host$request_uri";<br><br>  log_format cache_log '$remote_addr - $remote_user [$time_local] "$request" ' '$status $upstream_cache_status $body_bytes_sent "$http_referer" ' '" $http_user_agent" "$http_x_forwarded_for"';<br><br>   sendfile on;<br>   sendfile_max_chunk 512K;<br>   aio sendfile;<br>   tcp_nopush on;<br>   read_ahead 256K;<br><br>   open_file_cache max=1000 inactive=20s;<br>   open_file_cache_valid 30s;<br>   open_file_cache_min_uses 2;<br>   open_file_cache_errors on;<br><br>  keepalive_timeout  120;<br>  keepalive_requests 10000;<br><br>  client_max_body_size 99M;<br><br><span class="Apple-tab-span" style="white-space: pre;">  </span> gzip  on;<br><span class="Apple-tab-span" style="white-space: pre;">    </span> gzip_buffers      48 8k;<br><span class="Apple-tab-span" style="white-space: pre;"> </span> gzip_comp_level   4;<br><span class="Apple-tab-span" style="white-space: pre;">    </span> gzip_http_version 1.0;<br><span class="Apple-tab-span" style="white-space: pre;">    </span> gzip_vary<span class="Apple-tab-span" style="white-space: pre;">   </span>on;<br><span class="Apple-tab-span" style="white-space: pre;">     </span> gzip_disable "MSIE [1-6]\.(?!.*SV1)";<br><span class="Apple-tab-span" style="white-space: pre;">   </span> gzip_proxied    any;<br><span class="Apple-tab-span" style="white-space: pre;">       </span> gzip_types    text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>error_log /var/log/nginx/nginx.error.log;<br><br><br>   geoip_country  /usr/local/etc/nginx/geoip/GeoIP.dat; # the country IP database<br>   geoip_city     /usr/local/etc/nginx/geoip/GeoLiteCity.dat; # the city IP database<br><br></div><div><br></div><div>}</div><div><br></div><div><br></div><div><br></div></div><div>The config file for this site =</div><div><br></div><div>server {<br>      server_name  <a href="http://mobi.allairgoo.net">mobi.********.net</a>  *******.mobi <a href="http://allairgoo.net">****** net</a> <a href="http://www.allairgoo.net">www.********.net</a>  ;<br>#       listen       80 accept_filter=httpready sndbuf=32K ;<br><br>      error_page   500 502 503 504  /50x.html;<br>      location = /50x.html {<br>          root   /usr/local/www/nginx-dist;<br>      }<br>      access_log  /var/log/nginx/******.access.log cache_log;<br>      error_log /var/log/nginx/******.error.log;<br><span class="Apple-tab-span" style="white-space: pre;">       </span>location = /favicon.ico { access_log off; log_not_found  off; }<br>      location = /robots.txt {<br>              allow all;<br>              log_not_found off;<br>              access_log off;<br>      }<br>      location / {<br>              root   /home/www/api/wordpress;<br>              index  index.php index.html;<br>              rewrite ^/?feed/rss2$ /?feed=rss2 permanent;<br>              try_files $uri $uri/ /index.php;<br>       # this serves static files that exist without running other rewrite tests<br>        if (-f $request_filename) {<br>            expires 30d;<br>            break;<br>        }<br>        # this sends all non-existing file or directory requests to index.php<br>        if (!-e $request_filename) {<br>            rewrite ^(.+)$ /index.php?q=$1 last;<br>        }<br>      }<br>      location ~ \.php$ {<br><br><span class="Apple-tab-span" style="white-space: pre;">       </span>set $no_cache '0';<br>     # If non GET/HEAD, don't cache & mark user as uncacheable for 1 second via cookie<br>     if ($request_method !~ ^(GET|HEAD)$) {<br>         set $no_cache '1';<br>     }<br>     # Drop no cache cookie if need be<br>     # (for some reason, add_header fails if included in prior if-block)<br>     if ($no_cache = '1') {<br>         add_header Set-Cookie "_mcnc=1; Max-Age=2; Path=/";<br>         add_header X-Microcachable "0";<br>     }<br>     # Bypass cache if no-cache cookie is set<br>     if ($http_cookie ~* "_mcnc") {<br>                 set $no_cache '1';<br>     }<br><span class="Apple-tab-span" style="white-space: pre;">    </span>#   Bypass cache if Iphone<br><span class="Apple-tab-span" style="white-space: pre;">    </span>if ($http_user_agent ~ (iPhone|Android) ) {<br> <span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span> set $no_cache '1';<br><span class="Apple-tab-span" style="white-space: pre;">        </span>  }<br><br><span class="Apple-tab-span" style="white-space: pre;"> </span>if ( $http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {<br><span class="Apple-tab-span" style="white-space: pre;">     </span><span class="Apple-tab-span" style="white-space: pre;">  </span>set $no_cache '1';<br><span class="Apple-tab-span" style="white-space: pre;">      </span>}<br><br><span class="Apple-tab-span" style="white-space: pre;">     </span>#Don't cache the following URLs<br><span class="Apple-tab-span" style="white-space: pre;"> </span>if ($request_uri ~* "/(wp-admin/|wp-login.php)")<br><span class="Apple-tab-span" style="white-space: pre;">      </span>{<br><span class="Apple-tab-span" style="white-space: pre;">       </span><span class="Apple-tab-span" style="white-space: pre;">  </span>set $no_cache '1';<br><span class="Apple-tab-span" style="white-space: pre;">      </span>}<br><br>   <span class="Apple-tab-span" style="white-space: pre;">   </span># Bypass cache if flag is set<br><span class="Apple-tab-span" style="white-space: pre;">   </span>if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-locations.php|sitemap(_index)?.xml|[a-z0-9_-]+-sitemap([0-9]+)?.xml)") { <br><span class="Apple-tab-span" style="white-space: pre;">      </span><span class="Apple-tab-span" style="white-space: pre;">  </span>set $no_cache "1";<br><span class="Apple-tab-span" style="white-space: pre;">    </span> }   <br><br><br><span class="Apple-tab-span" style="white-space: pre;">        </span># Don't use the cache for logged in users or recent commenters<br><span class="Apple-tab-span" style="white-space: pre;">  </span>if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {<br><span class="Apple-tab-span" style="white-space: pre;">        </span><span class="Apple-tab-span" style="white-space: pre;">  </span>set $no_cache '1';<br><span class="Apple-tab-span" style="white-space: pre;">      </span>}<br><br><span class="Apple-tab-span" style="white-space: pre;">     </span>add_header X-Cache $upstream_cache_status;<br><br>       location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {<br>               expires 7d;<br>       }<br><br>########<br><br>     fastcgi_no_cache $no_cache;<br>     fastcgi_cache_bypass $no_cache;<br>     fastcgi_cache microcache;<br>     fastcgi_cache_key $server_name|$request_uri;<br><br>     fastcgi_cache_valid   200 302  1h;<br>     fastcgi_cache_valid   301      1d;<br>     fastcgi_cache_min_uses  1;<br><br>     fastcgi_cache_use_stale updating error timeout invalid_header http_500;<br>     fastcgi_cache_bypass $http_pragma;<br>     fastcgi_pass_header Set-Cookie;<br>     fastcgi_pass_header Cookie;<br>     fastcgi_ignore_headers Cache-Control Expires Set-Cookie;<br><br><span class="Apple-tab-span" style="white-space: pre;">    </span>fastcgi_split_path_info ^(.+\.php)(/.+)$;<br>     #    fastcgi_split_path_info ^(.+\.php)(.*)$;<br>     fastcgi_pass   127.0.0.1:9000;<br>     fastcgi_index  index.php;<br>     fastcgi_param  SCRIPT_FILENAME  /home/www/api/wordpress/$fastcgi_script_name;<br>     fastcgi_param  QUERY_STRING     $query_string;<br>     fastcgi_param  REQUEST_METHOD   $request_method;<br>     fastcgi_param  CONTENT_TYPE     $content_type;<br>     fastcgi_param  CONTENT_LENGTH   $content_length;<br>     fastcgi_intercept_errors        on;<br>     fastcgi_ignore_client_abort     off;<br>     fastcgi_connect_timeout 120;<br>     fastcgi_send_timeout 300;<br>     fastcgi_read_timeout 300;<br>     fastcgi_buffer_size 128k;<br>     fastcgi_buffers 256 8k;<br>     fastcgi_busy_buffers_size 256k;<br>     # all replies that are greater than the FastCGI buffers and transfer data synchronously to the client set fastcgi_max_temp_file_size to 0 <br>     fastcgi_max_temp_file_size 0; <br>     fastcgi_temp_file_write_size 1024k;<br>     include fastcgi_params;<br>     }<br><br><br>  }</div></div></body></html>