Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to configure Nginx to disable access to a directory or file

Shulou Source: shulou.com Published: 2022-05-31 13:10:36 09月24日 Update

This article mainly introduces "how to configure Nginx to prohibit access to a directory or file" related knowledge, editor through the actual case to show you the process of operation, the method of operation is simple and fast, practical, I hope that this "how to configure Nginx to prohibit access to a directory or file" article can help you solve the problem.

The copy code is as follows:

Location = / config/ {

Return 404

}

Location = / config.ini {

Return 404

}

This can only prohibit access to / / www.jb51.net/path/

The copy code is as follows:

Location = / path/ {

Return 404

}

Disable access to / / www.jb51.net/path/test.php

The copy code is as follows:

Location ^ ~ / test

{

Deny all

}

Maybe test should be changed to path.

This is the end of the content about "how to configure Nginx to prohibit access to a directory or file". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Code files directories configuration knowledge industry different practical content practical practical articles methods more cases knowledge points articles information channels processes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn Shulou Tech Info MySQL Docker