Web / Caddy Server Interview questions
How do you serve static files with Caddy?
Static file serving needs just two directives inside a site block: one to point at the folder on disk, and one to actually hand files to clients.
example.com { root * /var/www/html file_server }
root * sets the file root for all matched requests, and file_server reads matching files from that root, automatically serving index.html for directory requests and setting caching headers like ETag. Add file_server browse instead of a plain file_server if you want an auto-generated directory listing for folders that have no index file.
More Related questions...