The default indexing is enabled in Apache web server using the Options +Indexes or Options Indexes directive.
Disable Directory Listing in Apache
To disable the directory listing for a specific directory, add the following settings in Apache Virtual Host or create a .htaccess file in that directory with below content. The Options -Indexes disabled the listing of files on the website if an index file is missing.
In Apache Virtual Host:
In .htaccess file:
While using the .htaccess, make sure that Apache server is enabled to use .htaccess files for that directory. In most cases, .htaccess is disabled by default.
Finally, restart the Apache service after making any changes in Virtual host to apply changes.