1.
-
Development Environment: own computer
-
Test environment: to provide environmental testers used
-
Pre-publishing environments: data generation and data is consistent environment, run the latest project code into the test
-
Production environment: the final release of the project on-line environment
-
Primary Domain Name is: www.leyou.com , leyou.com
-
Management domain: manage.leyou.com
-
(1) Local DNS
The browser will first look in hosts file to the machine's IP address, domain name mapping, and if found return IP, did not find the domain name server to resolve, usually resolved locally will fail, because the default this file is empty.
-
hosts file addresses under Windows: C: / Windows / System32 / drivers / etc / hosts
-
The path where the hosts file under Linux: / etc / hosts
# My hosts 127.0.0.1 localhost
127.0.0.1 api.leyou.com 127.0.0.1 manage.leyou.com
This realization of the relationship between domain names mapped.
Every time looking for the hosts file on the C drive and change is very troublesome, it is recommended a quick modification host of tools.
Decompress, run the exe file, the effect of:
-
127.0.0.1 api.leyou.com: our gateway Zuul
-
127.0.0.1 manage.leyou.com: Our back-end system address
4.nginx solve port problems
This is not the elegance. We hope that direct access to the domain name: HTTP: //manage.leyou.com . In this case the default port is 80, how can we transfer request to 9001 port it?
-
Reverse Proxy
-
Load Balancing
-
Dynamic Routing
-
(2) nginx as a web server
-
web application server, such as: Tomcat, Resin, Jetty
-
web服务器,如:Apache 服务器、Nginx、IIS
区分:web服务器不能解析jsp等页面,只能处理js、css、html等静态资源。
(3)nginx作为反向代理
-
代理:通过客户机的配置,实现让一台服务器代理客户机,客户的所有请求都交给代理服务器处理。
-
反向代理:用一台服务器,代理真实服务器,用户访问时,不再是访问真实服务器,而是代理服务器。
nginx可以当做反向代理服务器来使用:
-
我们需要提前在nginx中配置好反向代理的规则,不同的请求,交给不同的真实服务器处理
-
当请求到达nginx,nginx会根据已经定义的规则进行请求的转发,从而实现路由功能