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