[SOLVED] - How to configure Directory Listing in httpd-2.4

Issues related to applications and software problems and general support
Post Reply
User avatar
warron.french
Posts: 473
Joined: 2014/03/27 20:21:58

[SOLVED] - How to configure Directory Listing in httpd-2.4

Post by warron.french » 2020/05/15 20:02:03

I have been trying to build a disconnected Apache (httpd-2.4) web server to be a Package Repo Server on a CentOS-8.1 server.

I have been successful at installing, enabling, and starting httpd-2.4.
I have been able to create an index.html file, in /var/www/html, with some non-HTML formatted text in it and web-browse it from another machine.
I have been able to use the reposync command to grab content from a CentOS mirror server (which from my workplace was challenging on its own), and put it into /var/www/html, as well.

I used the following reposync commands exactly:

Code: Select all

reposync  -p  /var/www/html/  --download-metadata  --repo=AppStream
reposync  -p  /var/www/html/  --download-metadata  --repo=BaseOS
So, I have directories and files subordinate to /var/www/html such as:

Code: Select all

AppStream/
AppStream/Packages
AppStream/repodata
BaseOS/
BaseOS/Packages
BaseOS/repodata
However, with /var/www/html/index.html deleted now, I can not navigate into the directory structure in a web browser any more. I have to know the path explicitly to get to each level of the path.
For example I can do what you see in the file
AppStream-directory-explicit.PNG
AppStream-directory-explicit.PNG (80.91 KiB) Viewed 270 times
, but I must type in the address Url:- http://10.2.11.161/AppStream/.

If I type in only "http://10.2.11.161/" I see zilch, nada, nothing.

This is what is in my /etc/httpd/conf/httpd.conf file (on lines with no comments):

Code: Select all

<Directory  "/var/www/html">
Options +Indexes  +FollowSymLinks
AllowOverride  None
Require all granted
</Directory>
I even added the following to /etc/httpd/conf/httpd.conf:
LoadModule autoindex_module modules/mod_autoindex.so

The file mod_autoindex.so is in modules path.

Please help, as I am building this for a lab, to leverage a single server to be a kickstart and repo server for 3 different OS-variants and major versions; on a lab network that has limited access to the internet through a firewall and proxy (both).
Last edited by warron.french on 2020/05/19 00:30:29, edited 1 time in total.
Thanks,
War

User avatar
warron.french
Posts: 473
Joined: 2014/03/27 20:21:58

Re: How to configure Directory Listing in httpd-2.4

Post by warron.french » 2020/05/19 00:30:12

I figured out the problem, and it was stupid simple.

Remove the file /etc/httpd/conf.d/welcome.conf. Restart the httpd daemon.

It was that simple.
Thanks,
War

User avatar
TrevorH
Forum Moderator
Posts: 28594
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [SOLVED] - How to configure Directory Listing in httpd-2.4

Post by TrevorH » 2020/05/19 08:45:38

No, it wasn't that simple. If you remove the file, yum will put it back next time there is an update to the package that owns it. You should be editing it and commenting its contents out (like it says in that file) and then yum will spot it's modified and create a .rpmnew file alongside it and leave the modified version alone.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
warron.french
Posts: 473
Joined: 2014/03/27 20:21:58

Re: [SOLVED] - How to configure Directory Listing in httpd-2.4

Post by warron.french » 2020/05/19 12:40:13

Interesting, I didn't see any such suggestions in my file.
Thanks,
War

User avatar
TrevorH
Forum Moderator
Posts: 28594
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [SOLVED] - How to configure Directory Listing in httpd-2.4

Post by TrevorH » 2020/05/19 13:35:27

#
# 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.
#
...
(From /etc/httpd/conf.d/welcome.conf installed ~2 minutes ago)
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
warron.french
Posts: 473
Joined: 2014/03/27 20:21:58

Re: [SOLVED] - How to configure Directory Listing in httpd-2.4

Post by warron.french » 2020/05/19 14:41:40

Yep, doesn't look familiar.
Thanks,
War

Post Reply

Return to “CentOS 8 - General Support”