Options -Indexes not working

I am trying to configure a new droplet to disable Indexes on Apache2. However, no matter how I do it, I am able to view the index:

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

/etc/init.d/apache2 restart

Then when I load my droplet IP - http://xx.xx.xx.xx, I see the directory contents.

Any ideas what I’m doing wrong please? Thank you

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Ok, I’ve finally figured this out. Chalk it up to newbiness.

To anyone else having this issue - after some digging around, I noticed that /etc/apache2/sites-enabled had its own conf, which I believe is what @jarland was noting above as being a vhost conf? My understanding was that vhost was not enabled by default. But it seems it is?

Anyway, putting my conf directives in /etc/apache2/sites-enabled/000-default.conf, followed by a restart, worked as expected.

Thank you

DigitalOcean Employee
DigitalOcean Employee badge
March 4, 2019

Hey friend,

Make sure there are not any other configurations that may be overriding this. For example, if you’re placing that in the virtual host config then it might be overridden by /etc/apache2/apache2.conf. This is in my default install right now, for example:

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


Thank you for the reply, @jarland . At the moment I am not using vhost. The conf is made directly in /etc/apache2/apache2.conf:

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

    <LimitExcept GET POST>
            Deny from all


There is no ‘<Directory /var/www/html>’ and the actual /var/www/html directory is empty, meaning no .htaccess.

Any ideas please? Thank you

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel