中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Nginx參數proxy_pass細說

發布時間:2020-08-04 18:45:19 來源:ITPUB博客 閱讀:251 作者:1向2飛 欄目:建站服務器

Syntax:

proxy_pass URL;

Default:

Context:

location, if in location, limit_except

        Sets the protocol and address of a proxied(代理) server and an optional URI to which a location should be mapped. As a protocol, “http” or “https” can be specified. The address can be specified as a domain name or IP address, and an optional port:

proxy_pass http://localhost:8000/uri/;

or as a UNIX-domain socket path specified after the word “unix” and enclosed in colons:

proxy_pass http://unix:/tmp/backend.socket:/uri/;

        If a domain name resolves to several addresses, all of them will be used in a round-robin fashion(流行). In addition, an address can be specified as a server group.

        Parameter value can contain variables. In this case, if an address is specified as a domain name, the name is searched among the described server groups, and, if not found, is determined(確定) using a resolver(解析器).

A request URI is passed to the server as follows:

·         If the proxy_pass directive(指令) is specified with a URI, then when a request is passed to the server, the part of a normalized request URI matching the location(location后匹配的路徑) is replaced by a URI specified in the directive:

解釋:如果在proxy_pass指令后的地址帶有uri,同時location后也帶有uri,這時在客戶端發出請求時,proxy_pass后的uri將覆蓋location后的uri向后端web服務器發出請求。

location /name/ {

    proxy_pass http://127.0.0.1/remote/;

}

例如這個示例中請求過程如下:

1、客戶請求 curl http://NG_IP:port/name/index.html -->2、Nginx代理服務器 http://WEB_IP:port/remote/index.html --> 3、web服務器

·         If proxy_pass is specified without a URI, the request URI is passed to the server in the same form as sent by a client when the original request is processed, or the full normalized request URI is passed when processing the changed URI:

解釋:如果proxy_pass沒有帶有uri,則使用原始的客戶端URI或location后指定的uri向后端web服務器發出請求。

location /some/path/ {

    proxy_pass http://127.0.0.1;

}

例如這個示例中請求過程如下:

1、客戶請求 curl http://NG_IP:port/some/path/index.html --> 2、Nginx代理服務器 http://WEB_IP:port/some/path/index.html --> 3、web服務器

 

Before version 1.1.12, if proxy_pass is specified without a URI, the original request URI might be passed instead of the changed URI in some cases.

In some cases, the part of a request URI to be replaced cannot be determined(確定):

·         When location is specified using a regular expression, and also inside(里面) named locations.

In these cases, proxy_pass should be specified without a URI.

解釋:如果location使用了正則,那么proxy_pass后就不能指定uri.

·         When the URI is changed inside a proxied location using the rewrite directive, and this same configuration will be used to process a request (break):

location /name/ {

    rewrite    /name/([^/]+) /users?name=$1 break;

    proxy_pass http://127.0.0.1;

}

In this case, the URI specified in the directive is ignored and the full changed request URI is passed to the server.

解釋:當在location中使用rewrite規則修改URI時,proxy_pass后的URI就會被忽略,而使用rewrite修改后的uri來作為實際的請求。

·         When variables are used in proxy_pass:

·         location /name/ {

·             proxy_pass http://127.0.0.1$request_uri;

·         }

In this case, if URI is specified in the directive, it is passed to the server as is, replacing the original request URI.

WebSocket proxying requires special configuration and is supported since version 1.3.13.

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

临安市| 岐山县| 邻水| 赤水市| 永平县| 工布江达县| 卢湾区| 阳泉市| 西和县| 禹州市| 德清县| 兴海县| 井冈山市| 商洛市| 富川| 任丘市| 准格尔旗| 孝昌县| 临沂市| 通城县| 河源市| 河池市| 丹寨县| 佛冈县| 淅川县| 铜陵市| 宝坻区| 中卫市| 册亨县| 辉县市| 同江市| 峨山| 沾益县| 郑州市| 关岭| 贵定县| 双鸭山市| 北京市| 博罗县| 平顺县| 孟州市|