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
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
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