If there is no index or default www file in directories, httpd returns the contents of directory instead like this.
Index of /temp
If you'd like to prevent the directory to be listed, you should reconfigure httpd.conf, here are the steps to do it:
- Find the right directive to change.
- Remove "Indexes" like this.
- Restart httpd
If you want to forbid all directory listing, then find <Directory "DocumentRoot"> directive, for example:
Options Indexes FollowSymLinks
Or, add a minus sign before "Indexes".
Options -Indexes FollowSymLinks
Now, you can try to list the directory again, this time, you should receive 403 error like this:
ForbiddenYou don't have permission to access /temp/ on this server.
Apache/2.2.26 (CentOS) Server at www.example.com Port 80
For more options of httpd server, please refer to the official document: core - Apache HTTP Server Version 2.4.