How to configure Nginx anti-leeching

WBOY
Release: 2023-05-21 10:04:11
forward
1048 people have browsed it

For service performance considerations, we usually store html static resources on multiple services according to different types.

If the topology map:

How to configure Nginx anti-leeching

The referer role in Hypertext Transfer Protocol

referer: null means the requester accesses directly

referer: blocked Generally added for firewall equipment

referer: url Indicates that the host in the url tells the requester about indirect access

jpg.good.com in the picture is obviously a dedicated The server where users store pictures, and www.good.com is a web server. It can be seen from the domain name that it must be a company. Conditions:

1. Only users who visit www.good.com are allowed to link Access jpg.good.com with your identity (referer: The host content in the url is www.good.com)

2. Reject referer: null (indicates direct access by the requester). Reject.

3. Prevent hot links (deny users from accessing jpg.good.com as a link; referer: the host content in the URL is not www.good.com)

Modify the hosts of the three machines The record is

How to configure Nginx anti-leeching

The test.html content created in the apache default directory /var/www/html is:

How to configure Nginx anti-leeching

nginx Main configuration file vi /etc/nginx/nginx.conf

How to configure Nginx anti-leeching

Reread the configuration file /etc/init.d/nginx reload (you can also restart the service restart)

Add pictures in /good/a.jpg

The client uses a browser to access http://www.good.com/test.html

Capture packets on nginx

How to configure Nginx anti-leeching

The client gets the picture and interprets it in the browser

How to configure Nginx anti-leeching

The above is the detailed content of How to configure Nginx anti-leeching. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template