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 control for Apache configuration

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

Share

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

Settings for access control:

Suppose: if you find an IP trying to * * my site in the log, you can block the IP through configuration.

Copy template

Vim / usr/local/apache2/conf/httpd.conf

AllowOverride None

Options None

Order allow,deny # Order: whoever comes first executes first. Neck and neck, only before and after.

Allow from all # allows all IP

Deny from 127.0.0.1 # controls this IP

[root@OBird ~] # apachectl-t

Syntax OK

[root@OBird ~] # apachectl restart

[root@OBird ~] # curl-x127.0.0.1 www.test.com 80-I

HTTP/1.1 403 Forbidden # can't access 127.0.0.1 at this time

Date: Tue, 27 Sep 2016 12:31:27 GMT

Server: Apache/2.2.31 (Unix) PHP/5.6.24

Content-Type: text/html; charset=iso-8859-1

-

Whitelist restrictions that restrict specified IP access.

[root@OBird ~] # vim / usr/local/apache2/conf/extra/httpd-vhosts.conf

Order Deny,Allow

Deny from all

Allow from 127.0.0.1

[root@OBird ~] # apachectl-t

Syntax OK

[root@OBird ~] # apachectl restart

[root@OBird ~] # curl-x10.72.4.30 www.test.com/admin.php 80-I

HTTP/1.1 403 Forbidden # restricted successfully, 403 cannot be accessed

Date: Tue, 27 Sep 2016 12:46:15 GMT

Server: Apache/2.2.31 (Unix) PHP/5.6.24

Content-Type: text/html; charset=iso-8859-1

-

[root@OBird ~] # curl-x127.0.0.1 www.test.com/admin.php 80-I

HTTP/1.1 200OK # can visit

Date: Tue, 27 Sep 2016 12:48:48 GMT

Server: Apache/2.2.31 (Unix) PHP/5.6.24

X-Powered-By: PHP/5.6.24

Set-Cookie: gfwC_2132_saltkey=IYZYTY7u; expires=Thu, 27-Oct-2016 12:48:48 GMT; Max-Age=2592000; path=/; httponly

Set-Cookie: gfwC_2132_lastvisit=1474976928; expires=Thu, 27-Oct-2016 12:48:48 GMT; Max-Age=2592000; path=/

Set-Cookie: gfwC_2132_sid=POGGLH; expires=Wed, 28-Sep-2016 12:48:48 GMT; Max-Age=86400; path=/

Set-Cookie: gfwC_2132_lastact=1474980528%09admin.php%09; expires=Wed, 28-Sep-2016 12:48:48 GMT; Max-Age=86400; path=/

Cache-Control: max-age=0

Expires: Tue, 27 Sep 2016 12:48:48 GMT

Content-Type: text/html; charset=gbk

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