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

Pygame code to make a snake game

Table of contents Pygame functions used Creating ...

Introduction to useRef and useState in JavaScript

Table of contents 1. useState hook 2. useRef hook...

CSS to achieve particle dynamic button effect

Original link https://github.com/XboxYan/no… A bu...

Use HTML and CSS to create your own warm man "Dabai"

The final result is like this, isn’t it cute… PS:...

CSS style does not work (the most complete solution summary in history)

When we write pages, we sometimes find that the C...

Simple comparison of meta tags in html

The meta tag is used to define file information an...

Solve the Linux Tensorflow2.0 installation problem

conda update conda pip install tf-nightly-gpu-2.0...

Web page CSS priority is explained in detail for you

Before talking about CSS priority, we need to und...

MySQL5.7 parallel replication principle and implementation

Anyone who has a little knowledge of data operati...

Nginx access log and error log parameter description

illustrate: There are two main types of nginx log...

Vite2.0 Pitfalls

Table of contents Vite project build optimization...

jQuery implements breathing carousel

This article shares the specific code of jQuery t...

Three implementation methods of Mysql copy table and grant analysis

How to quickly copy a table First, create a table...

Docker learning: the specific use of Container containers

Container is another core concept of Docker. Simp...

Talk about implicit conversion in MySQL

In the course of work, you will encounter many ca...