Hopefully some of you can help me out.

I'm a beginner when it comes to Apache and am trying to teach myself its core elements by going through the groundwork to set up a server with DirectoryListing and Password Authentication in my VMware on ubuntu.

What I want to accomplish: Be able to connect to "site1.com" and see a directory listing such as: https://imgur.com/a/gFhdY

My issue is the following:

I have the following code in my config file within /etc/apache2/sites-available/site1.com.conf (forgive the formatting, first post on here in years):

<VirtualHost *:80>
ServerAdmin serveradmin@admin.com
ServerName site1.com
ServerAlias www.site1.com
DocumentRoot /var/www/site1.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

 <Directory "/var/www/site1.com/public_html>
 AuthType Basic
 AuthName "Restricted Content"
 AuthUserFile /etc/apache2/.htpasswd
 Require valid-user
 Options Indexes
 Index Options FoldersFirst IgnoreCase

The password authentication works just fine, but I'm not sure where I'm supposed to put files to see if the Directory Listing works or if the Directory Listing simply doesn't work. When I connect to site1.com on my virtual machine, I simply see the contents of index.html within /var/www/site1.com/public_html/index.html and see no files listed.

Since the DocumentRoot is set to /var/www/site1.com/public_html, I assume this is where I place files. I've created a file called Test4.html and a folder called FolderTest within this directory for testing purposes, but as I wrote above, I'm not sure if these are in the right format or if they're even in the right place.

I've tried affixing a "+" before Indexes, so that it reads Options +Indexes but that didn't work either.

Any and all help would really be appreciated as I feel completely stuck and am unsure of where to go from here.

Kind regards, Victor


Remove index.html. The directory index is displayed only if an index file does not exist.

| improve this answer | |
  • Thank you so much! This begs the question, what purpose does index.html serve? Also: how do i select your answer as the best answer? :) – viKK Dec 29 '17 at 6:27
  • To accept the answer click on the check mark beside it! – George Udosen Dec 29 '17 at 7:48
  • Some people want to show a web page on their site, not a list of files. ;) – fkraiem Dec 29 '17 at 7:59
  • 1
    index.html is the default home page for a web site. with this file, you can just type in the web address and not have to specify the page ie example.com instead of example.com/home.html. – ravery Dec 29 '17 at 8:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.