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域名跳转案列的更多相关文章

  1. nginx 域名跳转 Nginx跳转自动到带www域名规则配置、nginx多域名向主域名跳转

    nginx 域名跳转 Nginx跳转自动到www域名规则配置,如果设置使 mgcrazy.com域名在用户访问的时候自动跳转到 www.mgcrazy.com呢?在网上找了好多资料都没有一个完整能解决 ...

  2. nginx域名跳转技巧

    1.地址重写:访问server_name的时候跳转到http://www.cnblogs.com/qinyujie/ 修改nginx配置文件.加入到server{...}字段或者location字段里 ...

  3. Nginx 域名跳转

    域名跳转 就是实现URL的跳转和隐藏真实地址,基于Perl语言的正则表达式规范.平时帮助我们实现拟静态,拟目录,域名跳转,防止盗链等 . 域名跳转配置 1.多域名指定一个域名重定向 # 空格分割域名 ...

  4. nginx 域名跳转一例~~~(rewrite、proxy)

    来自: http://storysky.blog.51cto.com/628458/486338/ 前几天搭了一个论坛服务器并放到了公司的局域网里面,论坛用的是9066端口并在路由器上面做了个端口转发 ...

  5. nginx域名跳转到www下

  6. nginx 301跳转到带www域名方法rewrite(转)

    首先一.得在你的域名管理里面定义 test.com和www.test.com指向你的主机ip地址,我们可以使用nslookup命令测试:直接输入 nslookup test.com和nslookup ...

  7. nginx实现域名跳转

    server { listen 80; server_name www.dd.com www.tt.com; index index.html index.htm index.php; root /u ...

  8. nginx 域名绑定端

    server { listen 80; server_name taqing.me www.taqing.me; ##,绑定域名 location / { proxy_pass http://127. ...

  9. [转] linux学习第四十四篇:Nginx安装,Nginx默认虚拟主机,Nginx域名重定向

    Nginx安装 进入存放源码包的目录: cd /usr/local/src 下载源码包: wget http://nginx.org/download/nginx-1.12.1.tar.gz 解压: ...

随机推荐

  1. tooltips插件

    摘要: 继‘带箭头提示框’,本文将分享几款带箭头提示框. qtipqTip是一种先进的提示插件,基于jQuery框架.以用户友好,而且功能丰富,qTip为您提供不一般的功能,如圆角和语音气泡提示,并且 ...

  2. c#POST请求php接口

    POST请求php接口 /// <summary> /// 指定Post地址使用Get 方式获取全部字符串 /// </summary> /// <param name= ...

  3. Hibernate_day04讲义_使用Hibernate完成对客户的条件查询

  4. ios开发之--UIButton中imageView和titleLabel的位置调整

    在使用UIButton时,有时候需要调整按钮内部的imageView和titleLabel的位置和尺寸.在默认情况下,按钮内部的imageView和titleLabel的显示效果是图片在左文字在右,然 ...

  5. ios开发之--NSNumber的使用

    什么是NSNumber? NSArray/NSDictionary中只能存放oc对象,不能存放基本数据类型,如果想把基本数据类型放进去,需要先把基本数据类型转换成OC对象, 代码如下: ; ; flo ...

  6. mybatis的selectOne和selectList没有数据返回时的问题

    1.使用mybatis的selectList方法,如果数据表中没有数据返回,则返回空集合[ ],而不会返回null,这是mybatis作的封装 @Override public List<Con ...

  7. iOS添加自定义字体

    字体有相应的字体文件,一般是以ttf或者otf为后缀,我们可以去一些第三方网站去下载(也有人专门做了字体出售),Google Fonts是个比较好的网站,可以去找找看.我们就用Open Sans这个字 ...

  8. .net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法实例?

    .net中单选按钮RadioButton,RadioButtonList 以及纯Html中radio的用法,区别? RadioButton实例及说明: <asp:RadioButton ID=& ...

  9. 使用API函数EnumWindows()枚举顶层窗口

      http://simpleease.blog.163.com/blog/static/1596085820052770290/ 要枚举Windows当前所有打开的顶层窗口,可使用Windows A ...

  10. php-fpm配置文件

    php-fpm配置文件 1.php-5.2的php-fpm <?xml version="1.0" ?> <configuration> <secti ...