httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bo Berglund <>
Subject [users@httpd] How to block Apache2 from showing dir lists on Ubuntu 16.04 server...
Date Mon, 11 Mar 2019 08:12:28 GMT
I have an Ubuntu 16.04-5 server machine running as an offsite
subversion backup via nightly svnsync from the main server.
The main server is based in the office of my company and the backup in
my home.

Now I want to expand the server's usage to host a different website
for personal use also entering via the router on port 443 (using
https:// URLs).

I am creating a copy of what I have on my web hosting but running on
my home server.

I have gotten most of what I want to do working but for directory
If I enter an URL ending with a directory name Apache throws up a list
of all of the files inside the directory which is NOT what I want.
I have created a php command to create the display of the dir content
which works just fine on my webhosting server but not on the ubuntu 16

This is what I have in my .htaccess file in this dir:

require valid-user
Options -Indexes
DirectoryIndex dirlist.php

But notwithstanding this Apache2 does not run the dirlist.php command
file to get the properly formatted list.

If I explicitly run the url ending with dirlist.php it works as
expected and I get my formatted directory list. But I want this to
happen also if the URL is just the directory itself.

So how can I make Apache NOT create the file list but instead run the
dirlist.php command?

I even went as far as editing the
/etc/apache2/sites-available/000-default.conf file and adding this to
the end of the directory block:

  <Directory "/var/www/html">
      AuthType Basic
      AuthName "Restricted Content"
      AuthUserFile /etc/apache2/private.htpasswd
      Require valid-user
      #Added to block dir listing and allow .htaccess to work
      AllowOverride All
      Options -Indexes

Then sudo service apache2 restart

But nothing at all changes...

Bo Berglund
Developer in Sweden

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message