Full process record of Nginx reverse proxy configuration

Full process record of Nginx reverse proxy configuration

1. Preparation

Install Tomcat on Linux system, use the default port 8080, and start the Tomcat server

Can be accessed normally

Next, we want to forward the request to the Tomcat server through the Nginx reverse proxy. The port number of the Nginx reverse proxy server is exposed to the outside, while Tomcat is not exposed to the outside. The browser cannot access Tomcat directly, but can only access Tomcat through the Nginx reverse proxy server

2. Reverse proxy configuration

Configure the mapping between domain name and IP address in the hosts file of Windows system

You can access the Tomcat server through the domain name port 8080

Then configure request forwarding in Nginx and configure reverse proxy

At this time, port 8080 is not accessed, but the Nginx proxy server is directly accessed. Nginx will reverse the proxy and forward the request to the Tomcat server on port 8080.

You can also configure Nginx's reverse proxy to jump to services on different ports based on different access paths.

First, start two Tomcat servers with different ports, one configured with port 8081 and the other with port 8082.

Start two Tomcat servers

At this point, ports 8081 and 8082 are both accessible

Configure Nginx reverse proxy server

After configuring the reverse proxy, access the file8081 page under the /test8081/ path. Nginx will use the reverse proxy to access the Tomcat server on port 8081.

Visit the file8082 page under the /test8082/ path, Nginx will reverse proxy to access the Tomcat server on port 8082

This allows requests to be forwarded to different servers through reverse proxies based on different access paths.

Summarize

This is the end of this article about Nginx reverse proxy configuration. For more relevant Nginx reverse proxy configuration content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Explanation of nginx load balancing and reverse proxy
  • Getting Started with Nginx Reverse Proxy
  • Nginx reverse proxy configuration to remove prefix case tutorial
  • How to implement Nginx reverse proxy for multiple servers
  • About nginx to implement jira reverse proxy

<<:  Understand the basics of Navicat for MySQL in one article

>>:  How to use html table (to show the visual effect of web page)

Recommend

How does MySQL achieve multi-version concurrency?

Table of contents MySQL multi-version concurrency...

Explanation of nginx load balancing and reverse proxy

Table of contents Load Balancing Load balancing c...

JavaScript to filter arrays

This article example shares the specific code for...

Vue implements simple notepad function

This article example shares the specific code of ...

MySQL 8.0.16 winx64 installation and configuration method graphic tutorial

I just started learning about databases recently....

How to use lazy loading in react to reduce the first screen loading time

Table of contents use Install How to use it in ro...

CSS3 implements the sample code of NES game console

Achieve resultsImplementation Code html <input...

Linux sar command usage and code example analysis

1. CPU utilization sar -p (view all day) sar -u 1...

js implements axios limit request queue

Table of contents The background is: What will ha...

Detailed steps to install mysql5.7.18 on Mac

1. Tools We need two tools now: MySQL server (mys...

Usage and description of HTML tag tbody

The tbody element should be used in conjunction wi...

Case study of dynamic data binding of this.$set in Vue

I feel that the explanation of this.$set on the I...