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

How to quickly clean up billions of data in MySQL database

Today I received a disk alarm exception. The 50G ...

Native JS to implement the aircraft war game

This article example shares the specific code of ...

CentOS7 64-bit installation mysql graphic tutorial

Prerequisites for installing MySQL: Install CentO...

Summary of webpack's mobile adaptation solution

Table of contents rem vw Adapt to third-party UI ...

Vue implements nested routing method example

1. Nested routing is also called sub-routing. In ...

Detailed explanation of the general steps for SQL statement optimization

Preface This article mainly shares with you the g...

Detailed steps to install MySQL 8.0.27 in Linux 7.6 binary

Table of contents 1. Environmental Preparation 1....

How to use bar charts in Vue and modify the configuration yourself

1. Import echart in HTML file <!-- Import echa...

js precise calculation

var numA = 0.1; var numB = 0.2; alert( numA + num...

Experience in designing a layered interface in web design

Many netizens often ask why their websites always ...

Summary of MySQL5 green version installation under Windows (recommended)

1 Download MySQL Download address: http://downloa...

Detailed explanation of MySQL DEFINER usage

Table of contents Preface: 1.Brief introduction t...