Running Centos 7 w/ Apache 2.4. Setting up a repository with a virtual host which I want to be able to display non-index.html files and directories in the document root directory. But when I access it in a browser, I get the Apache testing page. So, I look at /etc/httpd/conf.d/welcome.conf and see that all I need to do is comment out all the lines (tested it and it works as advertised). But I want to keep this functionality on all sites, just not on this single virtual host.

How do I disable the welcome page on a per virtual host basis?

[michael@mybox main]$ cat /etc/httpd/conf.d/welcome.conf
# This configuration file enables the default "Welcome" page if there
# is no default index page present for the root URL.  To disable the
# Welcome page, comment out all the lines below.
# NOTE: if this file is removed, it will be restored on upgrades.
<LocationMatch "^/+$">
    Options -Indexes
    ErrorDocument 403 /.noindex.html

<Directory /usr/share/httpd/noindex>
    AllowOverride None
    Require all granted

Alias /.noindex.html /usr/share/httpd/noindex/index.html
Alias /noindex/css/bootstrap.min.css /usr/share/httpd/noindex/css/bootstrap.min.css
Alias /noindex/css/open-sans.css /usr/share/httpd/noindex/css/open-sans.css
Alias /images/apache_pb.gif /usr/share/httpd/noindex/images/apache_pb.gif
Alias /images/poweredby.png /usr/share/httpd/noindex/images/poweredby.png
[michael@mybox main]$

Override it in the appropriate virtual host

<LocationMatch "^/+$">
    Options +Indexes

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.