Implementation of proxy_pass in nginx reverse proxy

Implementation of proxy_pass in nginx reverse proxy

The format is simple: proxy_pass URL;

The URL includes: transmission protocol (http://, https://, etc.), host name (domain name or IP:PORT), and uri.

Here is an example:

proxy_pass http://www.xxx.com/;
proxy_pass http://192.168.200.101:8080/uri;
proxy_pass unix:/tmp/www.sock;

There are several things to note about proxy_pass configuration:

Assume server_name is www.xxx.com

When requesting http://www.xxx.com/aming/a.html, the results of the above examples are

Example 1:

location /aming/
{
  proxy_pass http://192.168.1.10;
  ...
}

Result 1: http://192.168.1.10/aming/a.html

Example 2:

location /aming/
{
  proxy_pass http://192.168.1.10/;
  ...
}

Result 2: http://192.168.1.10/a.html

Example 3:

location /aming/
{
  proxy_pass http://192.168.1.10/linux/;
  ...
}

Result 3: http://192.168.1.10/linux/a.html

Example 4:

location /aming/
{
  proxy_pass http://192.168.1.10/linux;
  ...
}

Result 4: http://192.168.1.10/linuxa.html

Summarize:

For ease of memory and standardized configuration, it is recommended that all URLs after proxy_pass end with "/".

proxy_pass http://192.168.1.10/linux/;

This is the end of this article about the implementation of proxy_pass in nginx reverse proxy. For more relevant nginx reverse proxy proxy_pass content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of various usages of proxy_pass in nginx
  • Summary of Nginx location and proxy_pass path configuration issues
  • Detailed explanation of the difference between url ending with / and without / in nginx proxy_pass configuration
  • Proxy_pass method in multiple if in nginx location
  • Differences between proxy_pass in two modules in nginx

<<:  Vue implements a simple shopping cart example

>>:  Summary of HTML formatting standards for web-based email content

Recommend

MySQL Practical Experience of Using Insert Statement

Table of contents 1. Several syntaxes of Insert 1...

Copy the contents of one file to the end of another file in linux

Problem description: For example, the content of ...

Access the MySQL database by entering the DOS window through cmd under Windows

1. Press win + R and type cmd to enter the DOS wi...

How to redraw Button as a circle in XAML

When using XAML layout, sometimes in order to make...

Analysis of the reasons why Vue3 uses Proxy to implement data monitoring

Vue data two-way binding principle, but this meth...

Explanation of the execution priority of mySQL keywords

As shown below: from table where condition group ...

mysql three tables connected to create a view

Three tables are connected. Field a of table A co...

Complete steps to install MySQL 8.0.x on Linux

MySQL Introduction to MySQL MySQL was originally ...

Unbind SSH key pairs from one or more Linux instances

DetachKeyPair Unbind SSH key pairs from one or mo...

Detailed process of upgrading glibc dynamic library in centos 6.9

glibc is the libc library released by gnu, that i...

Three Discussions on Iframe Adaptive Height Code

When building a B/S system interface, you often en...

jQuery combined with CSS to achieve the return to top function

CSS Operations CSS $("").css(name|pro|[...

Install OpenSSL on Windows and use OpenSSL to generate public and private keys

1. OpenSSL official website Official download add...