Nginx reverse proxy forwards port 80 requests to 8080

Nginx reverse proxy forwards port 80 requests to 8080

Let's first understand a wave of concepts, what is nginx reverse proxy?

Reverse proxy means using a proxy server (here nginx) to receive requests on the network, that is, URL (the default is port 80).

1. Nginx makes some judgments on the URL (the forwarding rules are configured in the nginx configuration file), such as the port number (the default value of nginx is 80), which may be the secondary domain name.

For example, test1.baidu.com and test2.baidu.com are two second-level domain names. The first-level domain name here is baidu.com. DNS will resolve these two domain names to the same IP ( you need to add second-level domain name resolution (Alibaba Cloud needs to add resolution in domain name resolution. Different domain names can be resolved to the server with the same IP), or they can be resolved to different IPs separately )

2. After nginx is configured as a reverse proxy, it can forward requests for different secondary domain names to different ports or IPs and ports that can provide corresponding services.

That is to say, you enter test1.baidu.com in your browser

test2.baidu.com and press Enter. The actual access port (or IP, which depends on the configuration of the forwarding rules in your nginx) is different, and the service obtained is also different (this is the project in the nginx configuration file that forwards requests to different IPs and ports according to different domain names or request paths);

Let's take a screenshot online: client: It is the client browser, which can be a mobile browser or a PC browser

That blue cloud is the Internet

Reverse proxy server: server configured with nginx

Web server, file server --- Tomcat or other containers (with web projects deployed) that provide services. These servers are usually in the same LAN.

To put it simply, the external network accesses the same port (80), which is forwarded to different ports on the internal network that provide different services through nginx.

Does this mean that we only need to open port 80 and can close port 8080?

I went to Alibaba Cloud to test it:

After shutting down 8080,

Modify the default.conf file of nginx

After wq saves the changes, start nginx: service nginx restart

That's it.

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
  • Implementation of multi-port mapping of nginx reverse proxy
  • Example of using Nginx reverse proxy to go-fastdfs
  • Nginx reverse proxy configuration removes prefix
  • Detailed explanation of Nginx reverse proxy example

<<:  RHEL7.5 mysql 8.0.11 installation tutorial

>>:  Summary of how to use bootstrap Table

Recommend

Summary of mysqladmin daily management commands under MySQL (must read)

The usage format of the mysqladmin tool is: mysql...

Viewing and analyzing MySQL execution status

When you feel that there is a problem with MySQL ...

SQL implementation of LeetCode (183. Customers who have never placed an order)

[LeetCode] 183.Customers Who Never Order Suppose ...

How to make ApacheBench support multi-url

Since the standard ab only supports stress testin...

Docker enables seamless calling of shell commands between container and host

As shown below: nsenter -t 1 -m -u -n -i sh -c &q...

Causes and solutions to the garbled character set problem in MySQL database

Preface Sometimes when we view database data, we ...

XHTML 1.0 Reference

Arrange by functionNN : Indicates which earlier ve...

Pitfall notes of vuex and pinia in vue3

Table of contents introduce Installation and Usag...

No-nonsense quick start React routing development

Install Enter the following command to install it...

Implementation of CSS dynamic height transition animation effect

This question originated from a message on Nugget...

A "classic" pitfall of MySQL UPDATE statement

Table of contents 1. Problematic SQL statements S...

Implementation of vite+vue3.0+ts+element-plus to quickly build a project

Table of contents vite function Use Environment B...

CSS3 uses animation attributes to achieve cool effects (recommended)

animation-name animation name, can have multiple ...

A must-read career plan for web design practitioners

Original article, please indicate the author and ...