NGINX域名跳转案列
1、不同域名不同路径跳转
nginx实现a.com/teacher域名跳转到b.com/student
若想实现上面题目的跳转,目前鄙人知道两种方式:
1.return
2.proxy_pass
具体体现在NGINX配置文件如下:
[root@dadong b]# cat /etc/nginx/nginx.conf
worker_processes ;
events {
worker_connections ;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout ;
server {
listen ;
server_name a.com;
location /teacher/ {
# return http://b.com/index.html; 第一种方法return
proxy_pass http://b.com/index.html; 第二种方法 proxy_pass
# root html/a;
# index index.html index.htm;
}
error_page /50x.html;
location = /50x.html {
root html;
}
}
server {
listen ;
server_name b.com;
location / {
root html/b;
index index.html index.htm;
}
error_page /50x.html;
location = /50x.html {
root html;
}
}
}
显示结果如下:

稍微有点差别的是我并没有在b.com站点下建立一个目录student。
NGINX域名跳转案列的更多相关文章
- nginx 域名跳转 Nginx跳转自动到带www域名规则配置、nginx多域名向主域名跳转
nginx 域名跳转 Nginx跳转自动到www域名规则配置,如果设置使 mgcrazy.com域名在用户访问的时候自动跳转到 www.mgcrazy.com呢?在网上找了好多资料都没有一个完整能解决 ...
- nginx域名跳转技巧
1.地址重写:访问server_name的时候跳转到http://www.cnblogs.com/qinyujie/ 修改nginx配置文件.加入到server{...}字段或者location字段里 ...
- Nginx 域名跳转
域名跳转 就是实现URL的跳转和隐藏真实地址,基于Perl语言的正则表达式规范.平时帮助我们实现拟静态,拟目录,域名跳转,防止盗链等 . 域名跳转配置 1.多域名指定一个域名重定向 # 空格分割域名 ...
- nginx 域名跳转一例~~~(rewrite、proxy)
来自: http://storysky.blog.51cto.com/628458/486338/ 前几天搭了一个论坛服务器并放到了公司的局域网里面,论坛用的是9066端口并在路由器上面做了个端口转发 ...
- nginx域名跳转到www下
- nginx 301跳转到带www域名方法rewrite(转)
首先一.得在你的域名管理里面定义 test.com和www.test.com指向你的主机ip地址,我们可以使用nslookup命令测试:直接输入 nslookup test.com和nslookup ...
- nginx实现域名跳转
server { listen 80; server_name www.dd.com www.tt.com; index index.html index.htm index.php; root /u ...
- nginx 域名绑定端
server { listen 80; server_name taqing.me www.taqing.me; ##,绑定域名 location / { proxy_pass http://127. ...
- [转] linux学习第四十四篇:Nginx安装,Nginx默认虚拟主机,Nginx域名重定向
Nginx安装 进入存放源码包的目录: cd /usr/local/src 下载源码包: wget http://nginx.org/download/nginx-1.12.1.tar.gz 解压: ...
随机推荐
- c#中如何退出程序后自动重新启动程序
//触发退出程序事件 private void button1_Click(object sender, EventArgs e) { Application.E ...
- openURL调用其他程序(转)
转自:http://blog.csdn.net/iefreer/article/details/8812708 一个应用程序,可以调用其它的应用程序的. 和其它应用程序进行通讯如果一个应用程序支持一些 ...
- js循环异常
1.当在循环数组时,数组发生变化,循环item 为定义undifined $.each(blogMng.commonKit.upLoadMng.medias, function (index, ite ...
- PMP模拟考试-2
1. Increasing resources on the critical path activities may not always shorten the length of the pro ...
- 网易 2016 实习研发project师 3道 编程题
1 比較重量 给定两颗钻石的编号g1,g2,编号从1開始.同一时候给定关系数组vector,当中元素为一些二元组.第一个元素为一次比較中较重的钻石的编号,第二个元素为较轻的钻石的编号.最后给定之前的比 ...
- 10 -- 深入使用Spring -- 5...2 在Spring中使用Quartz
10.5.2 在Spring中使用Quartz Spring 的任务调度抽象层简化了任务调度,在Quartz基础上提供了更好的调度抽象.本系统使用Quartz框架来完成任务调度,创建Quartz的作业 ...
- swift--CATransform3D的简单介绍
今天来了解下CATransform3D的一些基本的知识.CATransform3D是一个用于处理3D形变的类,其可以改变控件的平移.缩放.旋转.斜交等,其坐标系统采用的是三维坐标系,即向右为x轴正方向 ...
- springboot学习过程笔记
1.spring-boot-devtools热部署在IDEA中配置后不起作用(Eclipse设置了自动编译,所以不用额外设置) 1).pom.xml添加spring-boot-devtools依赖后 ...
- [转]redis的三种启动方式
来源:https://www.cnblogs.com/pqchao/p/6549510.html redis的启动方式1.直接启动 进入redis根目录,执行命令: #加上‘&’号使red ...
- vs 2010中如何检查内存泄露
首先,在文件头添加下面的内容: #ifdef _DEBUG#define DEBUG_CLIENTBLOCK new( _CLIENT_BLOCK, __FILE__, __LINE__)#else# ...