nginx 配置多个主机
<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 配置多个主机的更多相关文章
- Centos7 nginx配置多虚拟主机过程
一.前提准备 1.已经安装好了的Centos7服务器 2.ip 为192.168.1.209 [本次的配置ip] 3.确定防火墙等已经关闭 二.nignx配置文件参数详解 要配置多台虚拟主机,就需 ...
- nginx配置之虚拟主机功能
虚拟主机功能: 一个nginx下运行多个网址(站点域名) 方式一:nginx.conf中的http{}中的每一个server{}就是一个站点(相同端口): #虚拟主机1 server { listen ...
- LNMP配置——Nginx配置 —— 默认虚拟主机
一.配置 首先修改配置文件 #vi /usr/local/nginx/conf/nginx.conf 在最后一个结束符号}前加一行配置: include vhost/*.conf; 意思就是/usr/ ...
- nginx 配置虚拟主机
文章转载自:http://www.ttlsa.com/html/1571.html 上篇说道我们的nginx是安装在/usr/local/nginx/ cd conf 我们现在把所有的虚拟主机放在一个 ...
- nginx常用配置系列-虚拟主机
本来准备详尽的出一份nginx配置讲解,但nginx功能配置繁多,平常使用中使用最多的一般有: 1. 虚拟主机配置 2. HTTPS配置 3. 静态资源处理 4. 反向代理 ============= ...
- Nginx配置多个基于域名的虚拟主机+实验环境搭建+测试
标签:Linux 域名 Nginx 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://xpleaf.blog.51cto.com/9 ...
- 第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置
第四百零二节,Django+Xadmin打造上线标准的在线教育平台—生产环境部署,uwsgi安装和启动,nginx的安装与启动,uwsgi与nginx的配置文件+虚拟主机配置 软件版本 uwsgi- ...
- nginx笔记 安装nginx 配置 反向代理 多虚拟主机
1,检测linux上是否 通过yum安装了nginxrpm -qi nginx 2.安装nginx之前的依赖包yum install gcc patch libffi-devel python- ...
- nginx配置虚拟主机vhost的方法详解
Nginx vhost配置,可实现基于ip.端口号.servername的虚拟主机,同时可避免直接修改主配置文件.在nginx下配置虚拟主机vhost非常方便.这篇文章主要介绍了nginx配置虚拟主机 ...
随机推荐
- APUE16章的运行示例16-14
参考文章:http://blog.csdn.net/andyxie407/article/details/1672325 今天在运行在APUE第16章的16-14(客户端)和16-15(服务端)遇到了 ...
- 基于HTML5的SLG游戏开发(序)
2012年前后,HTML5游戏凭借跨平台.易移植.部署简单.节省成本等优点被炒的火热,经过一两年的快速发展,市场出现了一些成功地HTML5游戏产品,像磊友的<修仙三国>,神奇时 ...
- 亲测安装php
亲测安装php1.tar zvxf php-5.3.8.tar.gz 2.cd php-5.3.83../configure \ --prefix=/usr/local/php \--with-mys ...
- CSS的clip-path(转)
基本概念 clip-path从单词"clip path"的直译上来说,表示的就是裁剪路径.既然有裁剪,咱们就来了解这里面的几个简单的概念. 裁剪就是从某样东西剪切一块.比如说,我们 ...
- EF FluentAPI映射一对多 关系时候报错
提示很明显,不可为空的外键为空了,但是 问题是,我只是初始化 关系映射而已:见代码 public ColumnsCategoryMapConfiguration() { ToTable("C ...
- ashx页面 “检测到有潜在危险的 Request.Form 值”的解决方法(控制单个处理程序不检测html标签)
如题: 使用web.config的configuration/location节点. 在configuration节点内新建一个location节点,注意这个节点和system.webserver那些 ...
- 数据库连接报错之IO异常(The Network Adapter could not establish the connection)
Io 异常: The Network Adapter could not establish the connection 有以下四个原因: 1.oracle配置 listener.ora 和tnsn ...
- 请教如何实现UITextField值变化的实时监视
上网搜索以后发现基本的处理方法大概有三种1.KVO方式[textField addObserver:self forKeyPath:@"text" options:0 contex ...
- ios 键盘弹起
#pragma mark 键盘弹起操作 - (void)keyboardWillShow:(NSNotification *)notification{ NSDictionary *info = ...
- maven mirror
国内连接maven官方的仓库更新依赖库,网速一般很慢,收集一些国内快速的maven仓库镜像以备用. ====================国内OSChina提供的镜像,非常不错=========== ...