Nginx反向代理匹配部分二级域名或二级目录配置
server { charset utf-;
client_max_body_size 128M; # Add index.php to the list if you are using PHP
index index.html index.htm index.php; server_name *.tl.com; set $old_port ;
set $new_port ; if ($host = tl.com) {
rewrite ^ www.tl.com permanent;
} location ~ ^/$ {
set $port $new_port;
if ($host ~* ^(sj|xiangmu|admin|wap|m)\.(.+)) {
set $port $old_port;
}
proxy_pass http://127.0.0.1:$port;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} location ~* ^/(test|gongying|xuqiu|ask|index\.php)(/(.*))?$ {
proxy_pass http://127.0.0.1:8001;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} #转发到老版本站点
location ~* ^/(.+)$ {
proxy_pass http://127.0.0.1:8002;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
} server { listen ; charset utf-;
client_max_body_size 128M; root /web1; # Add index.php to the list if you are using PHP
index index.html index.htm index.php; server_name 127.0.0.1; location / {
index index.htm index.html index.php; if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$ last;
break;
}
} location ~ \.php/?.*$ { fastcgi_pass php_7_0; include snippets/fastcgi-php.conf;
}
} server { listen ; server_name 127.0.0.1; root /web2; # rewrite_log on; error_log /var/log/nginx/tlv4.error.log error; location = /favicon.ico {
log_not_found off;
error_log off;
rewrite_log off;
} location / {
index index.htm index.html index.php; include rewrites/new.tlv4.com.conf; #访问路径的文件不存在则重写URL转交给ThinkPHP处理
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$ last;
break;
}
} location ~ \.php/?.*$ { fastcgi_pass php_5_3; include snippets/fastcgi-php.conf;
} }
Nginx反向代理匹配部分二级域名或二级目录配置的更多相关文章
- 搭建Nginx反向代理做内网域名转发
由于公司内网有多台服务器的 http 服务要映射到公司外网静态 IP,如果用路由的端口映射来做,就只能一台内网服务器的 80 端口映射到外网 80 端口,其他服务器的 80 端口只能映射到外网的非 8 ...
- nginx反向代理:两个域名指向不同web服务端口
一台服务器上安装了zabbix服务和jumpserver服务,两个域名zabbix.xxxx.xxxx和jumserver.xxx.xxxx 一.编辑/etc/nginx/conf.d目录下nginx ...
- Linux使用nginx反向代理。可实现域名指向特定端口
在配置80指向域名的时候出现端口占用,使用kill -9无法杀死端口,应使用下面的命令来杀死进程killall -9 nginx(使用完本命令需要再把配置过的配置文件重新启动.命令写在了PS下面)后在 ...
- Tomcat多个项目部署,通过Nginx反向代理分别配置二级域名的流程
购买域名.示例:example.com 设置多个二级域名.如图: 配置tomcat文件: 修改tomcat/conf目录下的server.xml文件: 如下配置配置了3个容器,使用三个不同的端口. 请 ...
- node项目发布+域名及其二级域名配置+nginx反向代理+pm2
学习node的时候也写了一些demo.但是只是限于本地测试,从来没有发布.今天尝试发布项目. 需要准备的东西 node 项目:为了突出重点,说明主要问题.我只是拿express 写了很简单的demo. ...
- 把www.domain.com均衡到本机不同的端口 反向代理 隐藏端口 Nginx做非80端口转发 搭建nginx反向代理用做内网域名转发 location 规则
负载均衡-Nginx中文文档 http://www.nginx.cn/doc/example/loadbanlance.html 负载均衡 一个简单的负载均衡的示例,把www.domain.com均衡 ...
- 端口被占用通过域名的处理 把www.domain.com均衡到本机不同的端口 反向代理 隐藏端口 Nginx做非80端口转发 搭建nginx反向代理用做内网域名转发 location 规则
负载均衡-Nginx中文文档 http://www.nginx.cn/doc/example/loadbanlance.html 负载均衡 一个简单的负载均衡的示例,把www.domain.com均衡 ...
- 使用Nginx反向代理绕过域名备案详解
之前笔者在景安云搞过一个Wordpress博客,然后域名备案也是在景安云上面搞的,后来又搞了一个阿里云的服务器,想把博客迁移到阿里云并且使用Ghost博客,然后使用二级域名链接到阿里云,结果出事了.景 ...
- nginx 反向代理 取得真实IP和域名
nginx反向代理后,在应用中取得的ip都是反向代理服务器的ip,取得的域名也是反向代理配置的url的域名,解决该问题,需要在nginx反向代理配置中添加一些配置信息,目的将客户端的真实ip和域名传递 ...
随机推荐
- java进程
package com.process; public class ProcessTest { public static void main(String[] args) { new Proce ...
- 从汇编看c++中的placement operator new
placement operator new是重载的operator new运算符,它允许我们将对象放到一个指定的内存中.下面来看c++源码: class X { private: int _x; p ...
- css3 页面退出和进入的动画
@-webkit-keyframes slideIn { from { -webkit-transform: translate3d(100%,0,0); transform: translate3d ...
- 居然因为交换错了好几把。。。。,还有坑点是num1可以大于num2
完数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- Ucenter注册后,需要二次登录才能同步登录的解决方案
1. 打开配置文件config.inc.php 在根目录data目录下最下方定义 define('DZ_DBTABLEPRE', '你的表前缀'); 2.打开uc_server/model/user. ...
- 源码编译安装 PHP5.5.0,解决curl_exec访问HTTPS返回502错误的问题(修改PATH路径)
最近碰到一个奇怪的问题, PHP使用 curl_exec 访问 HTTPS 网页时, 返回502错误, 访问HTTP网页时没有问题, 用 echo phpinfo() ; 查看, 支持op ...
- 怎样在Github参与一个开源项目
转载:http://www.csdn.net/article/2014-04-14/2819293-Contributing-to-Open-Source-on-GitHub 最近一年开源项目特别的热 ...
- 【转】6.4.6 将驱动编译进Linux内核进行测试
原文网址:http://www.apkbus.com/android-98520-1-1.html 前面几节都是将Linux驱动编译成模块,然后动态装载进行测试.动态装载驱动模块不会随着Android ...
- toolkit,phonetextbox中实现用户按回车键会换行
今天,了解到一个需求,要在输入框中实现:用户按回车键后换行 输入框是toolkit中的phonetextbox 1.首先google了一下,了解到有MultiLine这个属性,但是找寻了一番之后,居然 ...
- cf472C Design Tutorial: Make It Nondeterministic
C. Design Tutorial: Make It Nondeterministic time limit per test 2 seconds memory limit per test 256 ...