====== Reverse Proxy - NGINX Reverse Proxy ======
When NGINX proxies a request, it:
* Sends the request to a specified proxy server.
* Fetches the response.
* Sends the response back to the client.
----
[[Reverse Proxy:NGINX Reverse Proxy:Passing Request Headers|Passing Request Headers]]
----
===== Pass to a domain =====
To pass a request to an HTTP proxied server, the **proxy_pass** directive is specified inside a location.
location /some/path/ {
proxy_pass http://www.example.com/link/;
}
**NOTE:** The address of the proxied server is followed by a URI, /link/.
* If the URI is specified along with the address, it replaces the part of the request URI that matches the location parameter.
* For example, the request with the /some/path/page.html URI will be proxied to http://www.example.com/link/page.html.
* However, if the address is specified without a URI, or it is not possible to determine the part of URI to be replaced, the full request URI is passed (possibly, modified).
----
===== Proxy to an IP Address (and optional port) =====
location ~ \.php {
proxy_pass http://127.0.0.1:8000;
}
----
===== References =====
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/