I am trying to have a webpage display the subdirectories of the html such as /images/
and /js/
and their subdirectories. But my nginx config for some reason responds 403 forbidden.
server {
listen 80;
server_name example.com www.example.com;
root /home/manuel/ftp/files;
index index.html;
location / {
try_files $uri /index.html;
}
location ~ ^/(images/|img/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt|favicon.ico) {
alias /home/manuel/ftp/files;
access_log off;
expires max;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /.ht {
deny all;
}
}
But the nginx error log shows
44678#44678: *4 directory index of "/home/manuel/ftp/files" is forbidden, client: 73.170.17.88, server: example.com, request: "GET /images/favicon.ico/ HTTP/1.1", host: "1.1.1.1", referrer: "http://1.1.1.1./"