Get the App
SLTechnology News&Howtos  ›  Servers  › 

Cloud Computing Learning Route syllabus Class Notes: Apache access Control

Shulou Source: shulou.com Published: 2022-06-02 03:50:23 09月22日 Update

Cloud Computing Learning Route syllabus Class Notes: Apache access Control:

=

I. types of directory access control

Set catalog properties

Host-based

Based on user

Host-based access control

Prepare the environment

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

[root@aliyun ~] # echo "download." > / var/www/edusoho/web/download/1.html

For http 2.4 + only

Case 1: allow all hosts to acc

AllowOverride None

Require all granted

AllowOverride All allows settings in .htaccess in the subdirectory to override the current setting

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

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

AllowOverride None

Require ip 202.106.0.0/24

Require ip 114.248.160.203

Case 3: deny access to only certain hosts

AllowOverride None

Require not ip 114.248.160.203

Require all granted

III. User-based access: user name and password are required for access

= = use unformatted text files

Create a password file

[root@tianyun ~] # htpasswd-cm / etc/httpd/conf/webpasswd user1

New password: enter password

Re-type new password: enter the password again

Adding password for user user1

-c create

-m MD5

[root@tianyun ~] # cat / etc/httpd/conf/webpasswd

User1:$apr1 $tkLV4/..$BL2nd2Wbx4I5ZAf5uv8ZS.

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

Configuration supports authentication

AllowOverride None

Require all granted

AuthType Basic

AuthName "welcome to tianyun.me..."

AuthUserFile / etc/httpd/webpasswd

Require valid-user

IV. Access control for files

Execution of .php files in the / var/www/edusoho/web/upload directory is not allowed

AllowOverride None

Require all granted

Order allow,deny

Deny from all

Tags: Controls hosts files passwords cases users directories subitems inputs outlines tutorials notes classes classroom notes routes learning passwords text formats features Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Tech Info Linux Apple macOS