我是靠谱客的博主 过时小猫咪,这篇文章主要介绍Nginx的反向代理和域名绑定,现在分享给大家,希望可以做个参考。

域名有一级域名和二级域名。只要买下一级域名后,二级域名就随便定义了。

比如taotao.com就是一级域名。

www.taotao.com、search.taotao.com、order.taotao.com、sso.taotao.com就都是二级域名了。

在系统发布时,应该把所有的域名和Nginx的服务器IP绑定,访问所有的域名都会相应到Nginx上,再有Nginx来反向代理。

需要配置Nginx的conf文件,处理各个请求。

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
upstream manager.taotao.com { server 192.168.226.135:8080; } upstream rest.taotao.com { server 192.168.226.142:8080; } upstream search.taotao.com { server 192.168.226.142:8081; } upstream sso.taotao.com { server 192.168.226.142:8082; } upstream order.taotao.com { server 192.168.226.142:8083; } upstream www.taotao.com { server 192.168.226.143:8080; } server { listen 80; server_name manager.taotao.com; location / { proxy_pass http://manager.taotao.com; index index.html index.htm; } } server { listen 80; server_name rest.taotao.com; location / { proxy_pass http://rest.taotao.com; index index.html index.htm; } } server { listen 80; server_name search.taotao.com; location / { proxy_pass http://search.taotao.com; index index.html index.htm; } } server { listen 80; server_name sso.taotao.com; location / { proxy_pass http://sso.taotao.com; index index.html index.htm; } } server { listen 80; server_name order.taotao.com; location / { proxy_pass http://order.taotao.com; index index.html index.htm; } } server { listen 80; server_name www.taotao.com; location / { proxy_pass http://www.taotao.com; index index.html index.htm; } }

 

最后

以上就是过时小猫咪最近收集整理的关于Nginx的反向代理和域名绑定的全部内容,更多相关Nginx内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(74)

评论列表共有 0 条评论

立即
投稿
返回
顶部