NGINX – Display Full Filename In Directory Listing

Home / NGINX – Display Full Filename In Directory Listing

nginx-logoIf you use NGINX as your webserver, there might be certain folders you want to display as a directory listing instead of serving up an HTML page. When I ran NGINX on my server, I noticed that it would truncate the filename to about 50 characters. This was unacceptable for the application I needed it for.

First step is to turn on directory listing in your conf file by setting autoindex on;

The next step is to edit a source file and recompile NGINX.

You’ll want to edit the file located at src/http/modules/ngx_http_autoindex_module.c.

Change these lines:

#define NGX_HTTP_AUTOINDEX_PREALLOCATE 50
#define NGX_HTTP_AUTOINDEX_NAME_LEN 50

to whatever you want, such as:

#define NGX_HTTP_AUTOINDEX_PREALLOCATE 100
#define NGX_HTTP_AUTOINDEX_NAME_LEN 100

By | 2016-10-16T15:55:51+00:00 December 10th, 2014|Categories: System Administration|Tags: , , , , , , |2 Comments

2 Comments

  1. mignonne May 19, 2015 at 2:26 am - Reply

    Hey I am so happy I found your site, I really found you
    by error, while I was searching on Digg for something
    else, Anyhow I am here now and would just like to say
    thanks a lot for a marvelous post and a all round interesting blog (I also
    love the theme/design), I don’t have time to read through it
    all at the moment but I have saved it and also added in your RSS feeds,
    so when I have time I will be back to read more, Please do keep up the excellent b.

  2. Website June 16, 2015 at 2:48 pm - Reply

    I’m curious to find out what blog system you’re utilizing? I’m experiencing some small security problems with my latest site and I’d like to find something more safeguarded. Do you have any solutions?|

Leave a Comment