我在Gentoo Linux上运行的nginx 1.4.0服务器出了问题。 我创build了一个fancyindex文件夹; 参数,而当我打开页面,连接似乎永远不会结束。 浏览器显示页面仍在加载,在linux上curl localhost显示fancyindex只返回页脚。 在1分钟之后接收页脚,并且连接结束。 我的文件夹/ var / www / public /是到/ home / me / public_html的符号链接。
这是我的nginx.conf:
user nginx nginx; worker_processes 1; error_log /var/log/nginx/error_log info; events { worker_connections 1024; use epoll; } http { include /etc/nginx/mime.types; default_type application/octet-stream; client_max_body_size 128M; sendfile on; tcp_nopush on; tcp_nodelay on; ignore_invalid_headers on; fancyindex_exact_size off; index index.php index.html; server { listen 80; server_name mywebsite.com root /var/www; location / { allow xxxx; deny all; } location /public { allow all; fancyindex on; } location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm-www.sock; include fastcgi.conf; } include security.conf; } }
这是我的security.conf:
location ~ /\.ht { deny all; }
日志清晰,nginx进程不阻塞(不使用100%cpu)ulimit -n返回1024
连接看起来像:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><style type="text/css">body,html {background:#fff;font-family:"Bitstream Vera Sans","Lucida Grande","Lucida Sans Unicode",Lucidux,Verdana,Lucida,sans-serif;}tr.e {background:#f4f4f4;}th,td {padding:0.1em 0.5em;}th {text-align:left;font-weight:bold;background:#eee;border-bottom:1px solid #aaa;}#list {border:1px solid #aaa;width:100%;}a {color:#a33;}a:hover {color:#e33;}</style> <title>Index of /public/</title> </head><body><h1>Index of /public/</h1> <table id="list" cellpadding="0.1em" cellspacing="0"> <colgroup><col width="55%"/><col width="20%"/><col width="25%"/></colgroup> <thead><tr><th>File Name</th><th>File Size</th><th>Date</th></tr></thead> <tbody><tr class="o"><td><a href="../">Parent directory/</a></td><td>-</td><td>-</td></tr><tr class="e"><td><a href="Foltest.zip">Foltest.zip</a></td><td> 844M</td><td>13-May-2013 14:06</td></tr> SOME TIME HERE </tbody></table></body></html>
打开ngx_http_fancyindex_module.c文件并find这一行:
r->headers_out.status = NGX_OK;
用。。。来代替:
r->headers_out.status = NGX_HTTP_OK;
编译Nginx。
这就是你所需要的。
fancyindex有一个脚注指令,但默认是“无”,所以它甚至不应该处理一个。 要确保它不是,请尝试在fancyindex_exact_size选项下面添加它:
fancyindex_footer ""