Analysis of the process of implementing Nginx+Tomcat cluster under Windwos

Analysis of the process of implementing Nginx+Tomcat cluster under Windwos

Introduction:

Nginx (pronounced the same as engine x) is a lightweight web server/reverse proxy server and email (IMAP/POP3) proxy server released under a BSD-like protocol. Developed by Russian programmer Igor Sysoev, it is used by Russia's large portal website and search engine Rambler (Russian: Рамблер). Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx's concurrency capabilities are indeed better than those of the same type of web servers. Users of nginx websites in mainland China include: Sina, NetEase, Tencent, etc.

download:

Tomcat still uses version 6.0. For configuration, refer to the link below this article

Nginx download address: http://nginx.org/

Install:

  • Create a new server folder in the C drive, and then use tomcat to create a running node tomcat-node1
  • Unzip the concurrently downloaded nginx-1.7.1.zip to the server and rename it to nginx
  • Start tomcat to ensure normal access. Here I set the tomcat running port to 10001
  • Double-click nginx.exe to run nginx. You can check whether it is running by visiting http://localhost

Related commands:

  • start nginx
  • nginx -s stop quickly shuts down Nginx, may not save relevant information, and quickly terminates the web service
  • nginx -s quit Shut down Nginx smoothly, save relevant information, and terminate the web service in an organized manner
  • nginx -s reload Reload because Nginx related configuration has been changed and needs to be reloaded
  • nginx -s reopen to reopen the log file

Configuration:

In order to test the integration, the simplest configuration is used here to forward all requests.

#Number of working child processes (usually equal to the number of CPUs or twice the number of CPUs)
worker_processes 1;
#Error log storage path [ debug | info | notice | warn | error | crit ]
error_log logs/error.log info;
#Specify the pid storage file pid logs/nginx.pid;
events {
	#Use network IO model Linux recommends epoll, FreeBSD recommends kqueue, and window does not specify #use epoll;
  worker_connections 1024; #maximum number of connections allowed}
http {
  include mime.types;
  default_type application/octet-stream;
  keepalive_timeout 65;
  gzip on;
	upstream mysvr { # Node list server localhost:10001 weight=5;
	}
  server {
    listen 8008;
    server_name localhost;
    charset UTF-8;
    location / { # All requests are forwarded to this defined node root /ROOT; # Define the default website root directory location of the server index index.html index.htm index.jsp; # Define the name of the homepage index file proxy_pass http://mysvr; # Request to redirect to the server list defined by mysvr}
  }
}

The key is to define the node list and then configure the forwarding processing of the request path

Deploy any test project on tomcat, and then access it through nginx port + project

For ease of use, two bat scripts are written to start and shut down the service

start.bat

@echo off
echo Starting core services begins......
E:
cd E:\service\nginx
start nginx
echo Core service started successfully......
pause
exit

stop.bat

@echo off
echo Core services are starting to shut down...
E:
cd E:\service\nginx
nginx -s stop
echo The core service has been shut down...
pause
exit

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:
  • A brief discussion on two current limiting methods in Nginx
  • Detailed explanation of how to use Nginx + consul + upsync to achieve dynamic load balancing
  • Detailed tutorial on configuring nginx for https encrypted access
  • How to view nginx configuration file path and resource file path
  • The advantages and disadvantages of nginx and lvs and their suitable usage environment
  • Configuration operations of different projects in the secondary directory after nginx configures the domain name

<<:  Mysql implements three functions for field splicing

>>:  Detailed explanation of the visualization component using Vue to compare the differences between two sets of data

Recommend

How to install OpenSuse on virtualbox

The virtual machine is installed on the host mach...

A few steps to easily build a Windows SSH server

The SSH mentioned here is called Security Shell. ...

Summary of common functions of PostgreSQL regular expressions

Summary of common functions of PostgreSQL regular...

Detailed steps to change the default password when installing MySQL in Ubuntu

Step 1: Enter the directory: cd /etc/mysql, view ...

JavaScript object-oriented implementation of magnifying glass case

This article shares the specific code of JavaScri...

Detailed explanation of the role of explain in MySQL

1. MYSQL index Index: A data structure that helps...

Description of the default transaction isolation level of mysql and oracle

1. Transaction characteristics (ACID) (1) Atomici...

How to display web pages properly in various resolutions and browsers

The key codes are as follows: Copy code The code i...

In-depth explanation of Vue multi-select list component

A Multi-Select is a UI element that lists all opt...

Steps to install MySQL 5.7 in binary mode and optimize the system under Linux

This article mainly introduces the installation/st...

Detailed steps for yum configuration of nginx reverse proxy

Part.0 Background The company's intranet serv...

Implementation of CSS heart-shaped loading animation source code

Without further ado, let me show you the code. Th...

Detailed explanation of CSS3+JS perfect implementation of magnifying glass mode

About a year ago, I wrote an article: Analysis of...

Detailed explanation of the new CSS display:box property

1. display:box; Setting this property on an eleme...

How to define input type=file style

Why beautify the file control? Just imagine that a...