0

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?

    1 Answer 1

    0

    use mod_dirlisting

    Description mod_dirlisting creates an HTML page listing the contents of the target directory.

    mod_dirlisting is disabled by default; to enable: dir-listing.activate = "enable"

    While lighttpd provides a handful of options to tweak how the directory listing is generated, there is no one-size-fits-all. If you want or need something custom, then you are welcome to use a custom generator (e.g. using Python or PHP) instead of using mod_dirlisting.

    1
    • Thank you for your answer. I have "dir-listing.activate = "enable"" as you can see in the second part (external.conf).Commentedyesterday

    You must log in to answer this question.

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.