环境:

本地外网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. Paper Reading:DetNet

    论文:DetNet: A Backbone network for Object Detection 发表时间:2018 发表作者:(Face++)Chao Peng, Gang Yu (Tsingh ...

  2. ndk学习之C语言基础复习----结构体、共用体与C++开端

    自己实现sprintf功能: 关于C中的系统函数sprintf在上次[https://www.cnblogs.com/webor2006/p/7545627.html]学习中已经用到过了,这里再来回顾 ...

  3. (三)AppScan扫描策略的选择

    使用 AppScan 进行扫描 针对大型网站的扫描,我们按照戴明环 PDCA 的方法论来进行规划和讨论,建议 AppScan 使用步骤:计划(Plan).执行(Do).检查(check).分析(Ana ...

  4. python_生成器

    生成器: # 生成器函数(内部是否包含yield) def func(): print('F1') yield 1 print('F2') yield 2 print('F3') yield 100 ...

  5. 自制tomcat镜像

    1.编写dockerfile FROM centos MAINTAINER raygift@qq.com # 安装vim RUN yum -y install vim net-tools ENV BA ...

  6. 文件和I/O

    一.读写文本数据 (1)使用open()函数配合rt模式读取文本文件的内容:( t 为默认的文本模式) (2)执行写入操作,使用wt模式,如果待操作文件已存在,会清除并覆盖其原先的内容: (3)对已存 ...

  7. strconv

    导入strconv包 Append Format Parse 字符串转其他类型 parse返回两个值,一个转换值,一个err,没有错误时,err返回的是nil,有错误,err接受错误信息. 整型转字符 ...

  8. Codeforces 1221 F Choose a Square

    题面 不知道大佬们怎么想的,反正我看到这种区间包含性质的并且score只和包含的区间与询问区间挂钩的题,马上就想到了扫描线23333 虽然革命方向无比正确,但却因为SB错误交了5次才 A. WA第一发 ...

  9. idea快捷方式1

    Ctrl+Alt+O 优化导入的类和包 Alt+Insert 生成代码(如get,set方法,构造函数等)   或者右键(Generate) fori/sout/psvm + Tab Ctrl+Alt ...

  10. c 判断数字是否无限

    /* isinf example */ #include <stdio.h> /* printf */ #include <math.h> /* isinf, sqrt */ ...