I've got a problem with my nginx 1.4.0 server running on Gentoo Linux. I've created a folder with fancyindex on; parameter and while I'm opening the page, the connection seems to never end. Browser shows that the page is still loading and curl localhost on linux shows that fancyindex returns all but footer. The footer is received after 1 minute aprox and than connection ends. My folder /var/www/public/ is a symbolic link to /home/me/public_html.

Here is my 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;

                listen 80;
                server_name mywebsite.com
                root /var/www;
                location /
                        allow x.x.x.x;
                        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;

Here is my security.conf:

location ~ /\.ht
        deny all;

Logs are clear, nginx process does not block (does not use 100% cpu) ulimit -n return 1024

The connection looks like:

<!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>



Open ngx_http_fancyindex_module.c file and find this line:

r->headers_out.status = NGX_OK;

Replace with:

r->headers_out.status = NGX_HTTP_OK;

Compile Nginx.

That' s all you need.

  • 1
    And... It works! – peku33 May 20 '13 at 21:09

There is a footer directive for fancyindex, but the default is "nothing" so it shouldn't even be processing one. To ensure it's not, try adding this below the fancyindex_exact_size option:

fancyindex_footer ""
  • Didn't change anything... – peku33 May 13 '13 at 18:45
  • I've edited the first post – peku33 May 13 '13 at 18:46
  • Do you have any symbolic links in this folder leading elsewhere? Does it occur with just this folder or others as well? Could be some sort of recursive searching nginx is doing. – Nathan C May 13 '13 at 19:03
  • Ok, I've removed symbolic link and created directory with same name. But still nothing changed. While using 'autoindex' instead of 'fancyindex' everything works correct. It's my test environment so I don't use indexing very often. – peku33 May 13 '13 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.