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 design and create adaptive web pages

With the popularization of 3G, more and more peop...

Solution to the problem of English letters not wrapping in Firefox

The layout of text has some formatting requiremen...

How to implement gzip compression in nginx to improve website speed

Table of contents Why use gzip compression? nginx...

Oracle deployment tutorial in Linux environment

1. Environment and related software Virtual Machi...

MySQL merge and split by specified characters example tutorial

Preface Merging or splitting by specified charact...

JavaScript file loading and blocking issues: performance optimization case study

Let me start with a question: When writing an HTM...

Vue uses the method in the reference library with source code

The official source code of monaco-editor-vue is ...

Vue+video.js implements video playlist

This article shares the specific code of vue+vide...

Detailed explanation of MySQL database binlog cleanup command

Overview Today I will mainly share how to correct...

CentOS6.9+Mysql5.7.18 source code installation detailed tutorial

CentOS6.9+Mysql5.7.18 source code installation, t...

Detailed explanation of the adaptive adaptation problem of Vue mobile terminal

1. Create a project with vue ui 2. Select basic c...

Apache Calcite code for dialect conversion

definition Calcite can unify Sql by parsing Sql i...