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

Access method of Apache virtual host (based on permissions)

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This chapter follows the previous article on the access methods of Apache virtual hosts.

Configuration and Application of Apache

The structure of this chapter

Apache configuration profile:

1.Apache connection retention

2.Apache access control

Apache log management:

1. Log segmentation

2.AWStats log analysis

Apache connection retention Apache connection retention related parameters

1.KeepAlive:

Whether to open and keep the connection, OFF closed, ON open.

2. KeepAlive 'Timeout

The maximum interval between multiple requests for a connection, after which two requests are disconnected.

3.MaxKeepAliveRequests:

The maximum number of requests that can be transmitted at a time

Overview of Apache access Control Apache access Control

1. Function:

Control access to website resources

Add access authorization to a specific site directory

two。 Common access control methods

Client address limit:

User authorization restrictions

Access control based on client address 1. Use Require configuration items to implement access control, and restrict 2. 5 in order. Can be used for

< Location >

< Directory >

< Files >

< Limit >

Common syntax for 3.Require configuration items in the configuration section

Require all granted

Require all denied

Require local

Require [not] host

Require [not] ip

< IP地址或网段列表>

# when using not to prohibit access, put it in the container and specify the appropriate restriction policy in the container

Demo: user authorization restrictions access add user authorization configuration: [root@localhost named] # cd / etc/httpd/conf/extra [root@localhost extra] # lsvhost.conf [root@localhost extra] # vim vhost.conf DocumentRoot "/ var/www/html/accp/" ServerName www.accp.com ErrorLog "logs/www.accp.com.error_log" CustomLog "logs/www.accp.com.access_log" common Require not ip 192.168.56.130 / / add IP addresses that are not allowed To test the IP address of the host win7, Require all granted # can access the accp02 segment at this time Cannot access accp network segment after modification, press Esc, enter: wq save exit [root@localhost extra] # systemctl restart httpd verify blacklist settings: enter: www.naccp.com is normal to access the content of the first page we wrote

But if we type: www.accp.com, we will jump to the home page of Apache instead of the content of the home page we wrote, indicating that the blacklist and whitelist is set successfully

Create a user authentication database: [root@localhost extra] # cd / etc/httpd/conf [root@localhost conf] # lsextra httpd.conf magic [root@localhost conf] # htpasswd-c / etc/httpd/conf/pwd test01New password: / / here is: abc1234 You can define Re-type new password: / / enter the above password Adding password for user test01 [root@localhost conf] # ls / / here you can see the pwd file extra httpd.conf magic pwd [root@localhost conf] # cat pwdtest01:$apr1 $PsatL6Av$SVm5oEaVh7YbnRU4NOBH./ this is the test01 password ciphertext [root@localhost conf] # htpasswd / etc/httpd/conf/pwd test02New password: Re-type new password: Adding password for user test02 [root@localhost conf] # cat pwdtest01:$apr1 $PsatL6Av$SVm5oEaVh7YbnRU4NOBH./test02:$apr1 $XzM8x3.v$Ozy.U6GXVzMaBKB4MKdMd/ [root@localhost conf] # cd extra/ [root@localhost extra] # lsvhost.conf [root@localhost extra] # vim vhost.conf DocumentRoot "/ var/www/html/accp02/" ServerName www.naccp.com ErrorLog "logs/www.accp02.com.error_log" CustomLog "logs/www.accp02.com.access_log" common AuthName "DocumentRoot" AuthType Basic AuthUserFile / etc/httpd/conf/ For more information on the modification of pwd Require valid-user #, please see [root@localhost extra] # systemctl restart httpd / / restart service verification: enter: www.naccp.com in the browser of win7 Enter and prompt us to enter the user name and password. Here we enter the previously set user name: test01, password: abc1234. After clicking to log in, you can see the content of the home page we wrote earlier.

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

Network Security

Wechat

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

12
Report