To avoid directory listing, you need to manually change the configuration of your web server so it does not display directory content. You can usually do that for all major web servers by using a simple text editor to edit the Nginx conf file, Apache web server .htaccess files, or Tomcat configuration files. For Microsoft IIS, you can turn off directory browsing using the IIS Manager GUI.
Learn how to disable directory listing for all major web servers.