Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to implement Apache access Control

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly analyzes the relevant knowledge points of how to carry out Apache access control, the content is detailed and easy to understand, the operation details are reasonable, and has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "how to control Apache access".

Apache access control

Type setting of directory access control

1. Catalog Properti

two。 Host-based

3. Based on user

Host-based access control

1. Prepare the environment

[root@aliyun ~] # rm-rf / var/www/edusoho/web/download/* [root@aliyun ~] # echo "download." > / var/www/edusoho/web/download/

.html is for http only

2.4 + case 1:

Allow all hosts to access

AllowOverride NoneRequire all granted

AllowOverride All

Allow settings in .htaccess in subdirectories to override current settings AllowOverride None does not allow settings in .htaccess in subdirectories to override current settings

Case 2: only allow access to the network segments 192.168.5.0 Universe 24 and 192.168.10.0Uniplic24

AllowOverride NoneRequire ip 202.106.0.0/24Require ip 114.248.160.203

Case 3: only some hosts are denied access to AllowOverride None

Require not ip 114.248.160.203Require all granted

Third, user-based access:

User name and password are required for access = = use an unformatted text file

1. Create a password file

[root@tianyun ~] # htpasswd-cm / etc/httpd/conf/webpasswd user1New password:

Enter the password Re-type new password:

Then enter the password Adding password for user user1-c to create-m MD5

[root@tianyun] # cat / etc/httpd/conf/webpasswd user1:$apr1 $tkLV4/..$BL2nd2Wbx4I5ZAf5uv8ZS.

[root@tianyun] # htpasswd-m / etc/httpd/conf/webpasswd user2

two。 Configuration supports authentication

AllowOverride NoneRequire all grantedAuthType BasicAuthName "welcome to tianyun.me..." AuthUserFile / etc/httpd/webpasswdRequire valid-user

Fourth, access control for files does not allow the execution of .php files in the / var/www/edusoho/web/upload directory

AllowOverride NoneRequire all granted

Order allow,denyDeny from all

This is the end of the introduction on "how to carry out Apache access control". More related content can be searched for previous articles, hoping to help you answer questions and questions, please support the website!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report