Ubuntu apache 禁止目录浏览

$ sudo vim /etc/apache2/sites-enabled/000-default

将Options后面Indexes前面加上"-"表示禁止目录浏览:

<Directory /var/www/>

  Options -Indexes

......

</Directory>

然后重启apache

$sudo service apache2 restart