current position:Home>Introduction to nginx (learning notes)

Introduction to nginx (learning notes)

2022-04-29 07:03:32Sparkle_ wsl


install Windows edition

Official website address
Download and unzip to the local directory ( Don't bring Chinese )


double-click nginx.exe Ready or use cmd nginx.exe that will do  Insert picture description here

Reverse agent configuration

server {
		#  Listening port 
		listen         88;
		#  Listening address 
		server_name    localhost;
		location /{
		#  Proxy to the server address 
		#  You can also use the path proxy 
		location /aop{

Case study

One service starts two , The ports are 8081 and 8082,81 visit http://localhost:88/cacheConfig/id 82 visit http://localhost:88/aop/test

  • When we visit http://localhost:88/cacheConfig/id When , The console can see  Insert picture description here
  • When we visit http://localhost:88/aop/test The console prints
     Insert picture description here

Load balancing configuration

upstream wsl{
		#  Server resources  weight  The weight , The higher the value, the higher the access rate 
		server weight=1;
		server weight=2;

Case study

  • A total of visits 3 Time http://localhost:88/cacheConfig/id Address , Console printing effect ,82 Will be interviewed 2 Time ,81 Be visited once
     Insert picture description here

copyright notice
author[Sparkle_ wsl],Please bring the original link to reprint, thank you.

Random recommended