<pre name="code" class="html">    server {
listen 8001;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / {
root /var/www/zjzc-web-frontEnd;
index index.html;
}
location /backoffice {
root /var/www/;
index index.html index.htm;
} location /zjzc-hy-front {
root /var/www/;
index index.html index.htm;
} location /zjzc-hy-web-admin {
root /var/www/;
index index.html index.htm;
} zjtest7-frontend:/var/www/zjzc-web-frontEnd# curl http://192.168.32.76:8001/backoffice/
hello backoffce
zjtest7-frontend:/var/www/zjzc-web-frontEnd# curl http://192.168.32.76:8001/zjzc-hy-front/
hello zjzc-hy-front
zjtest7-frontend:/var/www/zjzc-web-frontEnd# curl http://192.168.32.76:8001/zjzc-hy-web-admin/
hello zjzc-hy-web-admin
zjtest7-frontend:/var/www/zjzc-web-frontEnd# curl http://192.168.32.76:8001/
test jj 20160823 结合haproxy 跳转:
acl mgr_req path_beg -i /backoffice
use_backend mgrserver_8001 if mgr_req acl mgr_req path_beg -i /zjzc-hy-front
use_backend mgrserver_8001 if mgr_req acl mgr_req path_beg -i /zjzc-hy-web-admin
use_backend mgrserver_8001 if mgr_req acl url_static path_end .html .gif .png .jpg .css .js
use_backend mgrserver_8001 if url_static default_backend mgrserver_8001 zjtest7-haproxy:/root# curl http://www.zjtest7.com/backoffice/
hello backoffce
zjtest7-haproxy:/root# curl http://www.zjtest7.com/backoffice/
hello backoffce
zjtest7-haproxy:/root# curl http://www.zjtest7.com/zjzc-hy-front/
hello zjzc-hy-front
zjtest7-haproxy:/root# curl http://www.zjtest7.com/zjzc-hy-web-admin/
hello zjzc-hy-web-admin
zjtest7-haproxy:/root# curl http://www.zjtest7.com/
test jj 20160823 location ^~ /t/ {
root /www/root/html/;
}
如果一个请求的URI是/t/a.html时,web服务器将会返回服务器上的/www/root/html/t/a.html的文件。
												

nginx 配置多个主机的更多相关文章

  1. Centos7 nginx配置多虚拟主机过程

    一.前提准备 1.已经安装好了的Centos7服务器 2.ip 为192.168.1.209   [本次的配置ip] 3.确定防火墙等已经关闭 二.nignx配置文件参数详解 要配置多台虚拟主机,就需 ...

  2. nginx配置之虚拟主机功能

    虚拟主机功能: 一个nginx下运行多个网址(站点域名) 方式一:nginx.conf中的http{}中的每一个server{}就是一个站点(相同端口): #虚拟主机1 server { listen ...

  3. LNMP配置——Nginx配置 —— 默认虚拟主机

    一.配置 首先修改配置文件 #vi /usr/local/nginx/conf/nginx.conf 在最后一个结束符号}前加一行配置: include vhost/*.conf; 意思就是/usr/ ...

  4. nginx 配置虚拟主机

    文章转载自:http://www.ttlsa.com/html/1571.html 上篇说道我们的nginx是安装在/usr/local/nginx/ cd conf 我们现在把所有的虚拟主机放在一个 ...

  5. nginx常用配置系列-虚拟主机

    本来准备详尽的出一份nginx配置讲解,但nginx功能配置繁多,平常使用中使用最多的一般有: 1. 虚拟主机配置 2. HTTPS配置 3. 静态资源处理 4. 反向代理 ============= ...

  6. Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试

    标签:Linux 域名 Nginx 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xpleaf.blog.51cto.com/9 ...

  7. 第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置

    第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置 软件版本  uwsgi- ...

  8. nginx笔记 安装nginx 配置 反向代理 多虚拟主机

    1,检测linux上是否 通过yum安装了nginxrpm   -qi  nginx 2.安装nginx之前的依赖包yum install gcc patch libffi-devel python- ...

  9. nginx配置虚拟主机vhost的方法详解

    Nginx vhost配置,可实现基于ip.端口号.servername的虚拟主机,同时可避免直接修改主配置文件.在nginx下配置虚拟主机vhost非常方便.这篇文章主要介绍了nginx配置虚拟主机 ...

随机推荐

  1. 转战WebApp: 最适合Android开发者的WebApp框架

    随着移动端设备越来越多, 微信应用号即将发布, 越来越多的页面需要被移动浏览器承载, HTML5开发大热, 我们需要掌握Web开发的技能来适应时代变化. 合适的WebApp框架 AndroidUI4W ...

  2. 动态拼接 sql的时候 里面 如果有变量的话 按上面的方式进行处理

    set @Sql_Sql = N' select top 1 @m_zw=zw,@m_zh=temp from ket where zd=''ddd'' ' print @Sql_Sql EXEC s ...

  3. struts_ognl详解

  4. (转)system()函数

    [C/C++]Linux下system()函数引发的错误   今天,一个运行了近一年的程序突然挂掉了,问题定位到是system()函数出的问题,关于该函数的简单使用在我上篇文章做过介绍: http:/ ...

  5. 测测你适合从事Web前端开发吗

    一般初创的互联网公司最烧钱的时候往往都是刚刚获得风投或融资的时候,因为他们要把钱砸向前端,因为那时候没有客户访问,对于企业来说只有先做好前端技 术.做好客户体验一切才有可能.用户体验做好,才有人访问, ...

  6. 查询两个日期(时间)以内的数据,between and 或 and 连>= <=,to_date()

    between and 方法 select * from kk.kkhmd where larq between(to_date('2008-9-3','yyyy-mm-dd')) and (to_d ...

  7. eclipse build很慢的时候,有可能是js文件编译验证慢的问题

    第一步: 去除eclipse的JS验证: 将windows->preference->Java Script->Validator->Errors/Warnings-> ...

  8. Xcode 7真机测试详解

    1.准备 注意:一定要让你的真机设备的系统版本和app的系统版本想对应,如果不对应就会出现一个很常见的问题:could not find developer disk image 首先,准备好下面的设 ...

  9. (java)从零开始之-反射Reflect

    反射: 当一个字节码文件加载到内存的时候,jvm会对该字节码进行解剖,然后会创建一个对象的Class对象,把字节码文件的信息全部都存储到该Class对象中,我们只要获取到Class对象,我们就可以使用 ...

  10. javascript-处理XML

    /** * Created by Administrator on 2015/4/4. */ var XmlUtil=(function () { var createDocument= functi ...