Nginx - Proxy


proxy in Nginx


A proxy is defined in a location block

upstream targetService {
    # A keepalive directive sets the maximum number of upstream idle connections that can remain open at any given time (for each Nginx worker process).
    keepalive 64;

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_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-Proto "https";
	proxy_pass http://targetService;
	proxy_http_version 1.1;
	proxy_pass_request_headers on;
	proxy_set_header Connection "keep-alive";
	proxy_store off;



Proxy Pass

If the URI is specified along with the address, it replaces the part of the request URI that matches the location parameter.

For example, with the below configuration:

location /some/path/ {
    proxy_pass; # the end slash is important

Discover More
HTTP - Gateway (Reverse Proxy)

A reverse proxy (or gateway) is a proxy that is configured to appear to the client just like an ordinary web server. Traffic from the internet at large enters system through reverse proxy, which then...
HTTP - Proxy

An HTTP proxy is a proxy that re-routes the HTTP message (request and response). It sits between the client and the origin server. There is two kinds of proxy but they are just the same application,...
Nginx - Location block

A location block is a block that is located inside a server block and maps a a resource path to a destination path such as: a local directory or an other service (see ) A server block may have several...
Nginx - Server Block Definition

A server block is a block that define a web server endpoints. It maps an URI to: a local directory or an other URI () and set some configurations. It is the equivalent of a Virtual host for apache....

Share this page:
Follow us:
Task Runner