I want to deny download from wget on Nginx

Asked 2 years ago, Updated 2 years ago, 36 views

Question
Q1. Can Nginx refuse to download from wget?
Q2. Can Nginx deny downloading from wget only the specified extension?

What I don't understand
·Can you deny the download from wget, or do you have no choice but to deny the access from wget itself?
·Is it possible to reject wget as user agent?What happens to user agent when using wget?

Question Background
I'd like to know how Nginx can set what you can do with .htaccess

July 13, 2020
The questionnaire has been drastically modified

July 12, 2020
Changed "Don't download from me" to "Don't download from me".

centos nginx

2022-09-29 22:44

3 Answers

Well, there are Microsoft OneDrive and Google Drive, even if you don't bother to make them, so I think you can run them flexibly without sticking to Nginx.


2022-09-29 22:44

In order to do this, nginx needs to recognize itself and others.However, physical differences between ourselves and others are not information that nginx can recognize.Therefore, you will have to review your definition of yourself or manage it with something that is not nginx.

One way to review the definition of "self" is, for example, to allow only a specific IP address.But this will not be very convenient.Considering that you often want to have a laptop and connect from another network, you don't really want to assume that your IP address is always fixed.

Another option is to use password authentication at the nginx level (if you know the password, say yourself).If you are satisfied with BASIC or Digest authentication, you can use it just in case.

The only way to use something that is not nginx is to use ssh instead of wget and tie it up with file permission.If you want to read and write files on the server with user authentication, I think you might consider ssh first.

However, as 774RRR's answer, if you just want files that only you can see over the Internet, it's easier to manage and more convenient to use services such as Google Drive.


2022-09-29 22:44

While wget and other tools generally change the User-Agent, regular users can reject it with user-agent if they use Default.

Wget normally identifies as 'Wget/version', version being the current version number of Wget.

https://www.gnu.org/software/wget/manual/wget.html#index-user_002dagent

User-Agent Rejected by nginx:
http://www.scalescale.com/tips/nginx/block-user-agents-nginx/?replytocom=163615#


2022-09-29 22:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.