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

How to understand SELinux under Linux

Table of contents 1. Introduction to SELinux 2. B...

Ubuntu 18.04 disable/enable touchpad via command

In Ubuntu, you often encounter the situation wher...

Detailed explanation of Truncate usage in MYSQL

This article guide: There are two ways to delete ...

JavaScript generates random graphics by clicking

This article shares the specific code of javascri...

A quick review of CSS3 pseudo-class selectors

Preface If CSS is the basic skill of front-end de...

Ubuntu MySQL version upgraded to 5.7

A few days ago, the library said that the server ...

How to add conditional expressions to aggregate functions in MySql

MySQL filtering timing of where conditions and ha...

MySQL database SELECT query expression analysis

A large part of data management is searching, and...

Beginners learn some HTML tags (2)

Beginners can learn HTML by understanding some HT...

Design a simple HTML login interface using CSS style

login.html part: <!DOCTYPE html> <html l...

Hbase installation and configuration tutorial under Linux

Table of contents Hbase installation and configur...

How to use flat style to design websites

The essence of a flat website structure is simpli...