Apache configuration-maintaining connectivity and access control
Main points of content:
1. Analysis of Apache configuration.
Apache connection retention
Apache access control
I. Apache connection retention
Parameters related to Apache connection retention
KeepAlive
Whether to open and keep the connection, OFF closed, ON open.
KeepAlive' Timeout
The maximum interval between multiple requests for a connection, after which two requests are disconnected.
MaxKeepAliveRequests
The maximum number of requests that can be transmitted at a time
II. Overview of Apache access control
Apache access control
1. Function
Control access to website resources
Add access authorization to a specific site directory
2. Common access control methods
Client address limit
User authorization restrictions
3. Access control based on client address
Use Require configuration items to implement access control and restrict them sequentially
Can be used in, and configuration segments
4. Common syntax of Require configuration items
Require all qranted Require all deniedRequire localRequire [not] host Require [not] ip
[root@localhost ~] # vim / etc/httpd/conf/httpd.conf/vhost.conf / / configure files, configure blacklists, and set access permissions in virtual host configuration
III. Restrictions on user authorization
1. Create a user authentication database
[root@www ~] # htpasswd-c / etc/httpd/conf/pwd webadmin create user authentication database New password:Re-type new password:Adding password for user webadmin [root@www ~] # cat / etc/httpd/conf/pwd View settings webadmin:$apr1 $UENqa9TA$k/6Kb.IhlKdQ6QVTxsZs1
2. Add user authorization configuration
[root@www ~] # vim / etc/ttpd/conf/httpd.conf add user authorization configuration
< Directory "/usr/local/httpd/htdocs" >.AuthName "DocumentRoot" AuthType BasicAuthUserFile / etc/httpd/conf/pwdRequire valid-user [root@www ~] # systemctl restart httpd restart service