Sample Header Ad - 728x90

Lighttpd web server - show files in folder

0 votes
2 answers
173 views
I have Lighttpd web server on my Ubuntu server. It works as expected. But now I want that it shows files in folders. I follow the instructions, but it doesn't work. This is lighttpd.conf file: server.modules = ( "mod_access", "mod_auth", "mod_expire", "mod_redirect", "mod_setenv", "mod_dirlisting", "mod_rewrite" ) server.document-root = "/var/www/html" server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) server.pid-file = "/run/lighttpd.pid" server.username = "www-data" server.groupname = "www-data" # For lighttpd version 1.4.46 or above, the port can be overwritten in /etc/lighttpd/external.conf using the := operator # e.g. server.port := 8000 server.port = 80 # Allow streaming response # reference: https://redmine.lighttpd.net/projects/lighttpd/wiki/Server_stream-response-bodyDetails server.stream-response-body = 1 #ssl.read-ahead = "disable" index-file.names = ( "index.php", "index.html", "index.lighttpd.html" ) url.access-deny = ( "~", ".inc", ".md", ".yml", ".ini" ) static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) mimetype.assign = ( ".ico" => "image/x-icon", ".jpeg" => "image/jpeg", ".jpg" => "image/jpeg", ".png" => "image/png", ".svg" => "image/svg+xml", ".css" => "text/css; charset=utf-8", ".html" => "text/html; charset=utf-8", ".js" => "text/javascript; charset=utf-8", ".json" => "application/json; charset=utf-8", ".map" => "application/json; charset=utf-8", ".txt" => "text/plain; charset=utf-8", ".eot" => "application/vnd.ms-fontobject", ".otf" => "font/otf", ".ttc" => "font/collection", ".ttf" => "font/ttf", ".woff" => "font/woff", ".woff2" => "font/woff2" ) # Add user chosen options held in (optional) external file include "external*.conf" # default listening port for IPv6 falls back to the IPv4 port include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port include "/etc/lighttpd/conf-enabled/*.conf" And external.conf file: $HTTP["host"] =~ "slike" { server.document-root = "/var/www/html/slike/" accesslog.filename = "/var/log/lighttpd/access-slike.log" server.errorlog = "/var/log/lighttpd/error-slike.log" index-file.names = ( ) # An empty list means no index files are served dir-listing.activate = "enable" mimetype.assign = ( ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".html" => "text/html", ".css" => "text/css; charset=utf-8", ".js" => "application/javascript", ".json" => "application/json", ".txt" => "text/plain", ".svg" => "image/svg+xml" ) } If I have index.html file in the folder, the web server shows it to the visitor. If I remove the index.html file, I get "403 Forbidden". Any idea what can be wrong? EDIT - UPDATE: Here is what I found in LOG files (URL are changed!): 2025-04-30 07:20:05: (response.c.407) -- parsed Request-URI 2025-04-30 07:20:05: (response.c.409) Request-URI : /slike 2025-04-30 07:20:05: (response.c.411) URI-scheme : http 2025-04-30 07:20:05: (response.c.413) URI-authority : k2.test.eu 2025-04-30 07:20:05: (response.c.415) URI-path (clean): /slike 2025-04-30 07:20:05: (response.c.417) URI-query : 2025-04-30 07:20:05: (response.c.495) -- logical -> physical 2025-04-30 07:20:05: (response.c.497) Doc-Root : /var/www/html 2025-04-30 07:20:05: (response.c.499) Basedir : /var/www/html 2025-04-30 07:20:05: (response.c.501) Rel-Path : /slike 2025-04-30 07:20:05: (response.c.503) Path : /var/www/html/slike 2025-04-30 07:20:06: (response.c.407) -- parsed Request-URI 2025-04-30 07:20:06: (response.c.409) Request-URI : /slike/ 2025-04-30 07:20:06: (response.c.411) URI-scheme : http 2025-04-30 07:20:06: (response.c.413) URI-authority : k2.test.eu 2025-04-30 07:20:06: (response.c.415) URI-path (clean): /slike/ 2025-04-30 07:20:06: (response.c.417) URI-query : 2025-04-30 07:20:06: (response.c.495) -- logical -> physical 2025-04-30 07:20:06: (response.c.497) Doc-Root : /var/www/html 2025-04-30 07:20:06: (response.c.499) Basedir : /var/www/html 2025-04-30 07:20:06: (response.c.501) Rel-Path : /slike/ 2025-04-30 07:20:06: (response.c.503) Path : /var/www/html/slike/ 2025-04-30 07:20:06: (response.c.522) -- handling subrequest 2025-04-30 07:20:06: (response.c.524) Path : /var/www/html/slike/ 2025-04-30 07:20:06: (response.c.526) URI : /slike/ 2025-04-30 07:20:06: (response.c.528) Pathinfo : 2025-04-30 07:20:06: (mod_indexfile.c.151) -- handling the request as Indexfile 2025-04-30 07:20:06: (mod_indexfile.c.153) URI : /slike/ 2025-04-30 07:20:12: (connections.c.1492) connection closed - keep-alive timeout: 15 EDIT - UPDATE (2025-05-09): $HTTP["url"] =~ "^/slike" { server.document-root = "/var/www/html/slike/" accesslog.filename = "/var/log/lighttpd/access-slike.log" server.errorlog = "/var/log/lighttpd/error-slike.log" index-file.names = ( ) # An empty list means no index files are served dir-listing.activate = "enable" mimetype.assign = ( ".png" => "image/png", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".html" => "text/html", ".css" => "text/css; charset=utf-8", ".js" => "application/javascript", ".json" => "application/json", ".txt" => "text/plain", ".svg" => "image/svg+xml" ) }
Asked by JanezKranjski (131 rep)
Apr 27, 2025, 04:22 PM
Last activity: May 9, 2025, 06:05 AM