Welcome! Log In Create A New Profile

Advanced

Nginx autoindex not working - 404 error

Posted by archer72 
Nginx autoindex not working - 404 error
October 03, 2018 06:55AM
I have a server block which displays properly, unless I set it to autoindex. This results in a 404 not found error.

server block:

<code> server {
# listen 80;
# server_name $domain_name;
root /var/www/html/files;
# root /var/www/html;
# autoindex on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}
</code>
Solved: Nginx autoindex not working - 404 error
October 05, 2018 06:20AM
I solved this by adding this to nginx.conf

<--snip>
}
location /files {
autoindex on;
autoindex_exact_size off;
}
<--snip>

And this is my server block

<--snip>
server {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}
<--snip>

I am not sure what effect it had, but I also changed the root and sites available path from /var/www/html to /var/www
Re: Nginx autoindex not working - 404 error
February 08, 2019 08:50AM
Thanks, @archer72 friend for sharing your experience with us hope it really works for us also.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 104
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready