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

Detailed explanation of Linux text processing command sort

sort Sort the contents of a text file Usage: sort...

Interpretation of CocosCreator source code: engine startup and main loop

Table of contents Preface preparation Go! text St...

Vuex implements simple shopping cart function

This article example shares the specific code of ...

Steps to modify the MySQL database data file path under Linux

After installing the MySQL database using the rpm...

Detailed explanation of the use of redux in native WeChat applet development

premise In complex scenarios, a lot of data needs...

How to configure Http, Https, WS, and WSS in Nginx

Written in front In today's Internet field, N...

How to enable slow query log in MySQL

1.1 Introduction By enabling the slow query log, ...

MySQL inspection script (must read)

As shown below: #!/usr/bin/env python3.5 import p...

Difference and implementation of JavaScript anti-shake and throttling

Table of contents 1. Anti-shake 2. Throttling 3. ...

How to use MySQL 5.7 temporary tablespace to avoid pitfalls

Introduction MySQL 5.7 aims to be the most secure...

HTML uses regular expressions to test table examples

Here is an example code for using regular express...

One-click installation of MySQL 5.7 and password policy modification method

1. One-click installation of Mysql script [root@u...

Turn off the AutoComplete function in the input box

Now we can use an attribute of input called autoco...

Docker image creation Dockerfile and commit operations

Build the image There are two main ways to build ...