nginx——反向代理
来源:互联网 发布:机械手模拟软件 编辑:程序博客网 时间:2024/05/22 08:27
一.什么是反向代理
反向代理服务器决定哪台服务器提供服务。
二.Nginx实现反向代理
两个域名指向同一台nginx服务器,用户访问不同的域名显示不同的网页内容。两个域名是www.sian.com.cn和www.sohu.com
nginx服务器使用虚拟机192.168.101.3
第一步:安装两个tomcat,分别运行在8080和8081端口。
第二步:启动两个tomcat。
第三步:反向代理服务器的配置
upstream tomcat1 {server 192.168.25.148:8080; } server { listen 80; server_name www.sina.com.cn; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://tomcat1; index index.html index.htm; } } upstream tomcat2 {server 192.168.25.148:8081; } server { listen 80; server_name www.sohu.com; #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://tomcat2; index index.html index.htm; } }
第四步:nginx重新加载配置文件
第五步:配置域名
在hosts文件中添加域名和ip的映射关系
192.168.25.148 www.sina.com.cn
192.168.25.148 www.sohu.com
阅读全文
0 0
- 【Nginx】——反向代理
- 【Nginx】——反向代理
- nginx——反向代理
- Nginx学习—反向代理
- Nginx反向代理Nginx
- Nginx反向代理Nginx
- nginx入门(1)——反向代理
- 淘淘商城系列——nginx配置反向代理
- nginx 反向代理
- nginx 反向代理
- Nginx 反向代理https
- Nginx 反向代理设置
- nginx反向代理
- nginx 反向代理上网
- Nginx 反向代理设置
- NGINX实现反向代理
- nginx TCP 反向代理
- nginx 反向代理
- 曲周!曲周!!!
- Android软键盘弹出时把布局顶上去的解决方法
- 基于jQuery的移动轮播图(支持手机触屏)
- Android面经-基础篇(持续更新...)
- 不要过度依赖JQuery(三)
- nginx——反向代理
- 5种服务器网络编程模型讲解
- 谈谈你对MVC的理解
- solr安装和部署
- 虚拟机上面的LINUX 无法和宿主WIN上面的时间同步问题
- 利用 FFmpeg 在 Android 上做视频编辑
- BZOJ1232 安慰奶牛cheer (洛谷2916)
- PHPstorm激活方法
- 《Java编程思想》动态类型安全