How to use the location directive in the LinuxNginx configuration file

location Syntax: location [=|~|~*|^~] /uri/ { … } default: no context: server This directive accepts different structures depending on the URL. You can configure to use regular strings and regular expressions. If using regular expressions, you must use ~* The prefix selects a case-insensitive match or ~ selects a case-sensitive match. determine which location Directives match a specific directive, regular strings are tested first. The regular string matches the beginning of the request and is case-sensitive, the most specific match will be used (see below to understand nginx how to determine it). The regular expressions are then tested in the order in the configuration file. Finding the first matching regular expression will stop the search. If no matching regular expression is found, the regular string result is used. There are two ways to modify this behavior. The first method is to use “=” prefix, will only perform strict matching. If the query matches, the search will stop and the request will be processed immediately. Example: If “/” requests occur frequently, use “location = /” will speed up the processing of this request. The second is to use the ^~ prefix. Using this prefix with a regular string tells nginx not…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索