Difference between revisions of "Proxy pass (Reverse proxy)"
Jump to navigation
Jump to search
↑ https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
↑ http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version
Tags: Mobile web edit, Mobile edit |
|||
(23 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | <code>proxy_pass</code> directive in used in [[Nginx]] for [[Reverse Proxy]] configurations.<ref>https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/</ref> | + | {{lc}}<code>proxy_pass</code> directive in used in [[Nginx]] for [[Reverse Proxy]] configurations.<ref>https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/</ref> |
location /some/path/ { | location /some/path/ { | ||
Line 5: | Line 5: | ||
} | } | ||
+ | === Basic example === | ||
+ | [[server]] { | ||
+ | listen 8356; | ||
+ | |||
+ | location / { | ||
+ | proxy_pass http://www.example.com:80/ | ||
+ | } | ||
+ | } | ||
+ | |||
+ | === Advanced example === | ||
<pre> | <pre> | ||
− | + | server { | |
− | listen | + | listen 80; |
− | + | server_name www.example.com; | |
location / { | location / { | ||
− | proxy_pass http:// | + | proxy_set_header X-Forwarded-Host $host; |
+ | proxy_set_header X-Forwarded-Server $host; | ||
+ | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
+ | proxy_pass http://localhost:8090; | ||
} | } | ||
− | + | } | |
</pre> | </pre> | ||
+ | == Miscelaneous == | ||
+ | |||
+ | proxy_http_version 1.0 | 1.1; <ref>http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version</ref> Default, version 1.0 is used. Version 1.1 is recommended for use with [[keepalive]] connections and [[NTLM]] authentication. | ||
+ | |||
+ | *<code>[[proxy_set_header]]</code> | ||
+ | |||
+ | == Related directives == | ||
+ | * <code>[[upstream]]</code> ([[Load balancer|Load balancing]]) | ||
+ | * <code>[[rewrite]]</code> | ||
+ | * [[mod_proxy]] | ||
== See also == | == See also == | ||
* [[memcache]] | * [[memcache]] | ||
+ | * {{nginx.conf}} | ||
* {{Nginx}} | * {{Nginx}} | ||
[[Category:nginx]] | [[Category:nginx]] | ||
[[Category:web]] | [[Category:web]] |
Latest revision as of 16:42, 1 August 2023
proxy_pass
directive in used in Nginx for Reverse Proxy configurations.[1]
location /some/path/ { proxy_pass http://www.example.com/link/; }
Basic example[edit]
server { listen 8356; location / { proxy_pass http://www.example.com:80/ } }
Advanced example[edit]
server { listen 80; server_name www.example.com; location / { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://localhost:8090; } }
Miscelaneous[edit]
proxy_http_version 1.0 | 1.1; [2] Default, version 1.0 is used. Version 1.1 is recommended for use with keepalive connections and NTLM authentication.
Related directives[edit]
See also[edit]
- memcache
- Nginx:
nginx -t
,nginx.conf
,/etc/nginx/fastcgi.conf
, Nginx Sample Configurations,server
,ssl_certificate
,redirect
,return
,rewrite
,sendfile
,request_uri
,server_name
,listen
,/etc/nginx/snippets/
,/etc/nginx/sites-enabled/default
- Web server: Nginx:
/etc/nginx/nginx.conf
,nginx -t
, Nginx logs, Nginx change log, PHP,php-fpm
, Let's encrypt, Nginx directives, Reverse Proxy, Configure HTTP redirection Nginx, Return,proxy_pass (Reverse proxy)
,ngx_http_rewrite_module
,/etc/nginx/sites-enabled/
,error.log
,access.log
,/nginx status
, AIO
Advertising: