In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article analyzes "how to implement Apache access control". The content is detailed and easy to understand. Friends who are interested in "how to achieve Apache access Control" can follow the editor's idea to read it slowly and deeply. I hope it will be helpful to you after reading. Let's learn more about "how to implement Apache access control" with the editor.
Apache access control function
1. Control access to website resources
two。 Add access authorization to a specific site directory
Common access control methods
1. Client address limit
two。 User authorization restrictions
Access control based on client address
1. Use Require configuration items to implement access control and restrict them sequentially
two。 Can be used in, configuration segment
Common syntax of Require configuration items Require all grantedRequire all deniedRequire localRequire [not] host Require [not] ip when using not to prohibit access, you should place it in a container and specify the corresponding restriction policy example in the container to demonstrate client address restrictions for Apache access.
1. Check the IP address of the client first
two。 Configure the httpd extension profile
[root@localhost ~] # cd / etc/httpd/conf/extra / / extension configuration file directory [root@localhost extra] # lsvhost.conf [root@localhost extra] # vim vhost.conf / / Edit virtual host configuration file DocumentRoot "/ var/www/html/accp/" ServerName www.accp.comErrorLog "logs/www.accp.com.error_log" CustomLog "logs/www.accp.com.access_1og" common / / Container start tag Require not ip 192.168.235.140 / prevent hosts with IP 192.168.235.140 from accessing Require all granted / / Container end tag [root@localhost extra] # systemctl restart httpd / / restart service [root@localhost ~] # systemctl restart named [root@localhost ~] # systemctl stop firewalld.service [root@localhost ~] # setenforce 0
3. Use the client to test the web page
User authorization restrictions for Apache access
1. Create a user authentication database
[root@localhost ~] # cd / etc/httpd/conf/ / enter the httpd main configuration file [root@localhost conf] # htpasswd-c / etc/httpd/conf/pwd test / / create a user encrypted file If the file exists, you do not need to add-cNew password: / / enter the custom password Re-type new password: / / confirm the password enter Adding password for user test [root@localhost conf] # cat pwd / / View the user and password encryption test:$apr1 $VBfoRWHC$Feck.BITMYhaOlEKrc/1j.
two。 Configure domain name resolution
[root@localhost extra] # vim / etc/named.rfc1912.zones zone "naccp.com" IN {type master; file "naccp.com.zone"; allow-update {none;};}; [root@localhost extra] # cd / var/named [root@localhost named] # cp-p accp.com.zone naccp.com.zone [root@localhost named] # vim naccp.com.zone $TTL 1D @ IN SOA @ rname.invalid. (0; serial 1D; refresh 1H; retry 1W; expire 3H) Minimum NS @ A 127.0.0.1www IN A 192.168.235.142
3. Configure the httpd extension profile
[root@localhost conf] # cd / etc/httpd/conf/extra [root@localhost extra] # vim vhost.conf... / / the omitted part is not modified. Append the following Documentroot "/ var/www/html/accp02/" ServerName www.naccp.comErrorlog "logs/www.accp02.com.error_log" Customlog "logs/www.accp02.com.access_log" common AuthName "DocumentRoot" / / declaration entry AuthType Basic / / basic authentication type AuthUserFile / etc/httpd/conf/pwd / / verification file directory Require valid -user / / Authentication of authorized users [root@localhost extra] # systemctl restart httpd / / restart the service
4 use the client to test the web page
On how to achieve Apache access control to share here, I hope that the above content can make you improve. If you want to learn more knowledge, please pay more attention to the editor's updates. Thank you for following 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.