Yes and no.
Prevent the server from displaying a list of files if an index file is missing. index of password txt exclusive
Add rules to block access to *.txt , *.conf , *.log , *.sql , and *.bak files. Example for Apache: Understanding the Hidden Risks of the "Index of