<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. HTML表单介绍

    表单语法结构如下: <form action="url" method="get|post" name="value" enctype ...

  2. 利用 Lua 实现 App 动态化方案

    因为动态化的东西我第一次看实现方案的源码,而且目前还是大三的学生,缺少很多实践经验说错的地方还请原谅,也希望能指出,被告知.想了很久还是决定写出来,求大神勿喷. 并且我的一个朋友bestswifter ...

  3. 设置Eclipse中文API提示信息

    准备工作:下载中文API到本机:http://download.java.net/jdk/jdk-api-localizations/jdk-api-zh-cn/publish/1.6.0/html_ ...

  4. Java——(六)Collection之Queue集合

    ------Java培训.Android培训.iOS培训..Net培训.期待与您交流! ------- Queue集合 Queue集合用于模拟队列这种数据结构,队列通常是指“先进先出‘(FIFO)的容 ...

  5. MySQL日志概述

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/SJQ. http://www.cnblogs.com/shijiaqi1066/p/3859866.html ...

  6. java io 流基础

  7. Java_Activiti5_菜鸟也来学Activiti5工作流_之初识BPMN2.0的简单结构(五)

    <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http:// ...

  8. 全国OA系统下载地址(全)

    思道OAhttp://www.anyoffice.net微软.NET平台,支持64位 金和OAhttp://www.jinher.com 红帆OAhttp://www.ioffice.cn 致远OAh ...

  9. sqlserver触发器如何将一个库中的数据插入到另外一个库中

    需求:实现的功能就是,查询当前表的所有信息,插入到另外一个库中(同一台机器,同一个SqlServer) 解决:insert into dB2.dbo.TB2 select * from db1.dbo ...

  10. .net excel利用NPOI导入oracle

    1.链接数据库 引用System.Data.OracleClient: //数据库链接字符串   Data Source如:192.168.5.153:1521/orcl string linkStr ...