Open /etc/apache2/apache2.conf file in a text editor like vim.
Search for <Directory> directive inside the file.
Which will look something like below:

<Directory /var/www/>
   Options Indexes FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>

Next to 'Options', delete the option 'Indexes'.
This is what allows directory lising and deleting this option will disable directory listing.
The modified <Directory> directive will now look as below:

<Directory /var/www/>
   Options FollowSymLinks
   AllowOverride None
   Require all granted
</Directory>