Get the App
SLTechnology News&Howtos  ›  Network Security  › 

How to disable directory browsing and security configuration in apache httpd

Shulou Source: shulou.com Published: 2022-05-31 22:17:15 10月03日 Update

This article mainly introduces how apache httpd forbids directory browsing and security configuration, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

1. Prohibit directory browsing

Modify httpd.conf

Before modifying the directory configuration

Options Indexes FollowSymLinks AllowOverride None Order allow,deny Allow from all

After modifying the directory configuration

Options FollowSymLinks AllowOverride None Order allow,deny Allow from all

two。 Error page redirection

Turn on the rewrite redirection module

# LoadModule rewrite_module modules/mod_rewrite.so

Find the above module load entry and delete the comment

LoadModule rewrite_module modules/mod_rewrite.so

Redirect 403 errors to a file

Add two redirection rules to the configuration file

RewriteEngine On

ErrorDocument 403 / 403.html

But the above method doesn't seem to work for IE browsers. I can't find out why.

3. Access via IP is prohibited and access via domain name is allowed.

Add site configuration to the configuration file and point to the prohibited page

DocumentRoot "D:\ Apache22\ htdocs"

ServerName IP address

# ErrorLog "logs/ip-error.log"

# CustomLog "logs/ip-access.log" common

DirectoryIndex 403.html

Thank you for reading this article carefully. I hope the article "how to prohibit directory browsing and security configuration" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Configuration directory browse article file security module error page value interest reason at the same time address domain name point way more friends entry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Tech Info MariaDB Shulou Information OPPO Reno