Implementation of multi-port mapping of nginx reverse proxy

Implementation of multi-port mapping of nginx reverse proxy

Code Explanation

1.1 http:www.baidu.test.com defaults to 80, access "/" using reverse proxy, and then access local 8083;

1.2 8083 represents the local front-end engineering access address. The front-end needs to access the back-end data, "/", and continues to proxy to the back-end address 9803;

1.3 In this way, you can complete multiple port access as long as port 80 is opened.

1.4 The root configuration can be an absolute path or a relative path.

 server {
    listen 80;
    server_name www.baidu.test.com;#You need to fill in the domain name, separate multiple with commas location / {
      proxy_pass http://localhost:8083; 
      proxy_set_header Host $host; 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
      root /app/esop_web/esopschool;
      index index.html;
      try_files $uri $uri/ /index.html;
    }
    location /rest
      proxy_pass http://localhost:9803; 
      proxy_set_header Host $host; 
      proxy_set_header X-Real-IP $remote_addr; 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
  }

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of two ways to implement session persistence in Nginx reverse proxy
  • Nginx reverse proxy forwards port 80 requests to 8080
  • Example of using Nginx reverse proxy to go-fastdfs
  • Nginx reverse proxy configuration removes prefix
  • Detailed explanation of Nginx reverse proxy example

<<:  mysql 8.0.12 winx64 download and installation tutorial

>>:  MySQL Server 8.0.3 Installation and Configuration Methods Graphic Tutorial

Recommend

JDBC-idea import mysql to connect java jar package (mac)

Preface 1. This article uses MySQL 8.0 version Co...

Detailed steps to install nginx on Apple M1 chip and deploy vue project

brew install nginx Apple Mac uses brew to install...

Sharing several methods to disable page caching

Today, when developing, I encountered a method wh...

Docker uses root to enter the container

First run the docker container Run the command as...

Two ways to clear float in HTML

1. Clear floating method 1 Set the height of the ...

Tutorial on setting up scheduled tasks to backup the Oracle database under Linux

1. Check the character set of the database The ch...

Common interview questions and answers for web designer positions

1. What are the templates for ASP.NET Web applicat...

HTML table markup tutorial (28): cell border color attribute BORDERCOLOR

To beautify the table, you can set different bord...

Use of Linux sed command

1. Function Introduction sed (Stream EDitor) is a...

In-depth explanation of JavaScript this keyword

Table of contents 1. Introduction 2. Understand t...

Detailed explanation of MySql 5.7.17 free installation configuration tutorial

1. Download the mysql-5.7.17-winx64.zip installat...

The implementation process of extracting oracle data to mysql database

In the migration of Oracle database to MySQL data...

Uninstalling MySQL database under Linux

How to uninstall MySQL database under Linux? The ...