环境:

本地外网ip:123.58.251.166

、配置index.html网页

[root@host---- conf.d]# cat /web/sing/index.html
<h1>www.test1.com</h1>
[root@host---- conf.d]# cat /root/html/index.html
<h1>www.test2.com</h1> 、配置conf.d目录下配置文件 [root@host---- conf.d]# pwd
/etc/nginx/conf.d
[root@host---- conf.d]# ls
test1.conf test2.conf test3.conf
[root@host---- conf.d]# cat test1.conf
server {
listen ;
server_name 127.0.0.1:;
location / {
root /web/sing/;
index index.html index.htm;
}
} [root@host---- conf.d]# cat test2.conf
server {
listen ;
server_name 127.0.0.1:;
location / {
root /root/html/;
index index.html index.htm;
}
} [root@host---- conf.d]# cat test3.conf
upstream abc.com {
server 127.0.0.1: fail_timeout=20s;
server 127.0.0.1: fail_timeout=20s; #ip_hash; 打开后就会访问到一台上 } server { listen ;
server_name oa.test.com;
location / {
#反向代理的地址
proxy_pass http://abc.com;
}
} 、配置hosts [root@host---- conf.d]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: localhost localhost.localdomain localhost6 localhost6.localdomain6
123.58.251.166 oa.test.com [root@host---- conf.d]# nginx -s reload 、开始访问 注意:要从百度访问必须注册备案域名 [root@host---- ~]# curl http://oa.test.com
<h1>www.test1.com</h1>
[root@host---- ~]# curl http://oa.test.com
<h1>www.test2.com</h1>

nginx反向代理本地 两台web负载均衡 使用域名代理的更多相关文章

  1. nginx反向代理本地 两台web负载均衡 使用ip+端口代理

    环境: 本地外网ip:123.58.251.166 .配置index.html网页 [root@host---- conf.d]# cat /web/sing/index.html <h1> ...

  2. keepalived+nginx实现HA高可用的web负载均衡

    Keepalived 是一种高性能的服务器高可用或热备解决方案, Keepalived 可以用来防止服务器单点故障的发生,通过配合 Nginx 可以实现 web 前端服务的高可用.Keepalived ...

  3. Nginx反向代理 实现Web负载均衡

    实现负载均衡的方式有很多种,DNS.反向代理.LVS负载均衡器(软件实现).F5(负载均衡器,硬件,非常昂贵)这里我们只提到基于DNS,以及反向代理的方式来实现负载均衡Web服务       DNS服 ...

  4. nginx反向代理+缓存开启+url重写+负载均衡(带健康探测)的部署记录

    在日常运维工作中,运维人员会时常使用到nginx的反向代理,负载均衡以及缓存等功能来优化web服务性能. 废话不多说,下面对测试环境下的nginx反向代理+缓存开启+url重写+负载均衡(带健康探测) ...

  5. Nginx反向代理服务器、负载均衡和正向代理

    Nginx("engine x")是一个高性能的 HTTP 和反向代理服务器,第一个公开版本 0.1.0 发布于 2004 年 10 月 4 日.官方测试 nginx 能够支撑5万 ...

  6. Dubbo入门到精通学习笔记(十六):Keepalived+Nginx实现高可用Web负载均衡

    文章目录 Keepalived+Nginx实现高可用Web负载均衡 Keepalived+Nginx实现高可用Web负载均衡 高可用架构篇 Keepalived + Nginx 实现高可用 Web 负 ...

  7. Keepalived + Nginx 实现高可用 Web 负载均衡

    一.Keepalived 简要介绍 Keepalived 是一种高性能的服务器高可用或热备解决方案, Keepalived 可以用来防止服务器单点故障的发生,通过配合 Nginx 可以实现 web 前 ...

  8. web负载均衡整理

    参考:http://www.cnblogs.com/lovingprince/archive/2008/11/13/2166350.html http://www.cnblogs.com/loving ...

  9. 常见的web负载均衡方法总结

    Web负载均衡的方法有很多,下面介绍几种常见的负载均衡方法. 1.用户手动选择方法 这是一种较为古老的方式.通过在主站首页入口提供不同线路.不同服务器连接的方式,来实现负载均衡.这种方式在一些提供下载 ...

随机推荐

  1. javascript中如何判断数组是数组

    if (!Array.isArray) { Array.isArray = function(arg) { return Object.prototype.toString.call(arg) === ...

  2. 2018/7/31 -zznu-oj -问题 C: 磨刀- 【扩展欧几里得算法的基本应用】

    问题 C: 磨刀 时间限制: 1 Sec  内存限制: 128 MB提交: 190  解决: 39[提交] [状态] [讨论版] [命题人:admin] 题目描述 磨刀是一个讲究的工作,只能在n℃下进 ...

  3. python_并发编程——进程池

    1.进程池 from multiprocessing import Pool def func(n): for i in range(10): print(n+1) if __name__ == '_ ...

  4. Java并发包--线程池原理

    转载请注明出处:http://www.cnblogs.com/skywang12345/p/3509954.html 线程池示例 在分析线程池之前,先看一个简单的线程池示例. 1 import jav ...

  5. easyui-dialog打开之后append("标签")标签存在但是显示不出来

    初始化dialog $("#upDiv").dialog("open");//初始化dialog弹出窗口 注意: 1:  append("标签&quo ...

  6. [cf1138BCircus][枚举,列等式]

    https://codeforc.es/contest/1138/problem/B B. Circus time limit per test 1 second memory limit per t ...

  7. 了解 Spring Boot

    Spring Boot是什么,解决哪些问题? SpringBoot是伴随着Spring4.0诞生的: 从字面理解,Boot是引导的意思,因此SpringBoot帮助开发者快速搭建Spring框架: S ...

  8. sql server 的 out 和output

    sql中out与output   --SQLQuery Create By Faywool         create proc Proc_OutPutTest--创建 @numA int,--nu ...

  9. 爬虫----异步---高性能爬虫----aiohttp 和asycio 的使用

    前情提要: 首先膜拜loco大佬 肯定有人像我一样.不会异步,发一下. 一:性能比对 多进程,多线程,(这里不建议使用,太消耗性能) 进程池和线程池 (可以适当的使用) 单线程+异步协程   (推荐使 ...

  10. HTML的列表,表格与媒体元素

    一.无序列表 <ul>                            <li>无序列表</li>                            &l ...