[Business Function Chapter 85] Microservice-springcloud-Nginx-Reverse Proxy-Gateway

Nginx domain name

1.hosts file

In the c:/window/system32/drivers/etc/hosts file, we add in this file

192.168.56.100 msb.mall.com

Note that if you do not have permission to operate, then click the file, right-click properties, and remove the read-only attribute

Access the Nginx service through this domain name

2.Nginx direction proxy

image.png

image.png

3.Nginx load balancing

image.png

nginx.cof is the global configuration file /mydata/nginx/conf/nginx.cof.
The last information configured in the file include /etc/nginx/conf.d/*.conf means that other configuration files under this path will also be scanned, so For individual services, we can create a new pro.conf file for configuration to avoid the global configuration file being too large and difficult to maintain

image.png

image.png

The location configured here / the configured proxy_pass http://msbmall is the following upstream configuration of the reverse proxy: the value is msbmall Note
: The configuration of this reverse proxy gateway needs to be configured in the global configuration file nginx.cof
server is the designated service The 192.168.56.1 here demonstrates the local host ip, pointing to the gateway service port 8070 of our project

Insert image description here

Correspondingly, the configuration of the gateway needs to be modified.

image.png

Then you can access the homepage of the mall through the domain name

image.png

Guess you like

Origin blog.csdn.net/studyday1/article/details/132521757