Step 1) Creating a directory test under document Root for disabling. If you have an existing directory you can use that for disabling.
[root@master html]# mkdir -p /var/www/html/test
Step 2) Add the below configs in httpd.conf file ( -Indexes will disable the directory browsing )
<Directory "/var/www/html/test">
Options -Indexes +FollowSymLinks
AllowOverride None
Require all granted
</Directory>
Step 3) Check the syntax and Restart httpd service
[root@master html]# httpd -t
Syntax OK
[root@master html]# systemctl restart httpd
Step 4) Access the URL
[root@master html]# curl -Ik http://master/test
HTTP/1.1 301 Moved Permanently
Date: Fri, 12 Feb 2021 06:23:01 GMT
Server: Apache
Location: http://master/test/
Content-Type: text/html; charset=iso-8859-1
No comments:
Post a Comment