Enable Directory Browsing – Apache HTTPD Server

Windows Articles

How to install SQLite on OpenSUSE 15.2 / 15.1?

There are many good database management systems, but they are not all the same. And the fact that they are not, means...

How to detect port scanning and private IP access with Behave

Hello! Security when surfing the internet is a very serious issue. Consequently, the precautions we take are very important. Moreover, web browsers...

How to install LAMP on OpenSUSE 15.2 / 15.1?

It is increasingly common to find small companies that decide to use the SUSE ecosystem for their servers. It's an unsurprising decision because OpenSUSE...

How to use Mytop on Linux?

We already know that both MySQL and MariaDB are among the most popular database managers out there. They have earned this with...

How to activate the automatic screen saver in Windows 10

Hello! Undoubtedly the time we spend in front of a computer has grown lately. In fact, in these times of pandemic, more...
Mel Khamlichi
Mel Khamlichihttp://www.osradar.com
Founder of Osradar, from Amsterdam Netherlands

Enabling Directory browsing is not recommended because of security purposes. However, sometimes, you still need this option to show something like files, folders, and pictures or something else. Today, I will show you in my case that I created my CentOS Local repo based baseurl http. This example is tested in my VMware test CentOS 7 machine and its working very fine. Note that the default server application is Apache.

Please follow the bellow steps :

1. Remove the Welcome Page

2. Add the Virtual host.

3. Add content.

Remove Welcome Page
if you have no “index.html” files on the folder the apache will stay showing the welcome page. This why we have to remove it.

rm -rf /etc/httpd/conf.d/welcome.conf

Add the Virtual Host

I dedicated this vhost to CentOS packages. For this reason, I created the example vhsost – centos.osradar.com. In your case, please replace the vhost bellow with your own vshost  and dont forget to add the vhost  to  “/etc/hosts”   file  or “C:\Windows\system32\drivers\etc\hosts”

<VirtualHost centos.osradar.com:80>
ServerAdmin root@centos.osradar.com
ServerName centos.osradar.com
DocumentRoot /var/www/centos
<Directory “/var/www/centos“>
Options All Indexes FollowSymLinks
Require all granted
</Directory>
ErrorLog logs/centos.osradar.com-error_log
CustomLog logs/centos.osradar.com-access_log combined
</VirtualHost>

Add content
In my case, I want to see all my CentOS 7 ISO packages and  files

mkdir /var/www/centos

Mount the DVD ROM.

mount /dev/cdrom /var/www/centos

Restart the Apache server.

/etc/init.d/httpd restart

Test it by visiting the URL.

Disable or enable the firewall

firewall-cmd --permanent --add-service=http

firewall-cmd  --reload

Now check the links bellow

http://your.ip.add.ress  or http://hostname

Now you could see the directories and files

yon can use  this url  as yum repo url

[root@centos7a yum.repos.d]# cat /etc/yum.repos.d/rhel.repo
[centos-repo]
name = centos repo server
baseurl=http://centos.example.com
enabled=1
gpgcheck=0
[root@centos7a yum.repos.d]#

Is it Working? Check it out:

[root@centos7a yum.repos.d]# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id repo name status
centos-repo centos repo server 3,894
repolist: 3,894
[root@centos7a yum.repos.d]#

Yes, it’s working! Enjoy!

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to install SQLite on OpenSUSE 15.2 / 15.1?

There are many good database management systems, but they are not all the same. And the fact that they are not, means...

How to detect port scanning and private IP access with Behave

Hello! Security when surfing the internet is a very serious issue. Consequently, the precautions we take are very important. Moreover, web browsers...

How to install LAMP on OpenSUSE 15.2 / 15.1?

It is increasingly common to find small companies that decide to use the SUSE ecosystem for their servers. It's an unsurprising decision because OpenSUSE...

How to use Mytop on Linux?

We already know that both MySQL and MariaDB are among the most popular database managers out there. They have earned this with...

How to activate the automatic screen saver in Windows 10

Hello! Undoubtedly the time we spend in front of a computer has grown lately. In fact, in these times of pandemic, more...