nginx url问题
测试需求,url自动加/后,发现重定向不带端口,即为 test.a.com:3443/abc nginx自动重定向301到 test.a.com/abc,端口消失。
分析可能和nginx默认配置server_name_in_redirect 与 port_in_redirect 有关
1、server_name_in_redirect on(默认),URL 重定向为: server_name 中的第一个域名 + 目录名 + /;
2、server_name_in_redirect off,URL 重定向为: 原 URL 中的域名 + 目录名 + /。
If server_name_in_redirect is on, then Nginx will use the first value of the server_name directive for redirects. If server_name_in_redirect is off, then nginx will use the requested Host header.
更改nginx配置
server_name test.a.com:3443;
server_name_in_redirect on
即强制使用server_name得第一个域名,自己配置上端口
重启生效。
| Syntax: | server_name_in_redirect |
|---|---|
| Default: |
server_name_in_redirect off; |
| Context: | http, server, location |
Enables or disables the use of the primary server name, specified by the server_name directive, in absolute redirects issued by nginx. When the use of the primary server name is disabled, the name from the “Host” request header field is used. If this field is not present, the IP address of the server is used.
| Syntax: | port_in_redirect |
|---|---|
| Default: |
port_in_redirect on; |
| Context: | http, server, location |
Enables or disables specifying the port in absolute redirects issued by nginx.
The use of the primary server name in redirects is controlled by the server_name_in_redirect directive.
nginx url问题的更多相关文章
- nginx url自动加斜杠的问题
nginx url自动加斜杠问题及301重定向 时间:2016-02-04 15:14:28来源:网络 导读:nginx url自动加斜杠问题及301重定向,URL指向一个目录并且在最后没有包含斜杠, ...
- 很不错的NGINX URL重写实例
转自:http://www.jbxue.com/article/2187.html 本文介绍nginx URL重写的相关知识,包括301重定向的内容等,希望对大家有所帮助. nginx rewrite ...
- nginx url 重写 [转]
本文转自 http://www.jbxue.com/article/2187.html 本文介绍nginx URL重写的相关知识,包括301重定向的内容等,希望对大家有所帮助. nginx rewri ...
- Nginx URL重写(rewrite)配置及信息详解
URL重写有利于网站首选域的确定,对于同一资源页面多条路径的301重定向有助于URL权重的集中 Nginx URL重写(rewrite)介绍 和apache等web服务软件一样,rewrite的组要功 ...
- web服务器-Nginx URL重写
web服务器-Nginx URL重写 一. URL重写介绍 和apache等web服务软件一样,rewrite的主要功能是实现URL地址的重定向.Nginx的rewrite功能需要PCRE软件的支持, ...
- nginx url重定向
nginx内部支持url rewrite,内部编译进去了rewrite模块,nginx的rewrite模块类似于apache的rewriterule功能:支持多种规则和正则表达式: 详细介绍如下: N ...
- Nginx 笔记与总结(12)Nginx URL Rewrite 实例(ecshop)
访问项目地址:http://192.168.254.100/ecshop 某个商品的 URL:http://192.168.254.100/ecshop/goods.php?id=3 现在需要实现把以 ...
- nginx url重写 rewrite实例
本文介绍下,在nginx中实现Url重写,学习rewrite的具体用法,有需要的朋友参考下吧. 原文地址:http://www.360doc.com/content/14/0202/20/142341 ...
- A Script Pro nginx URL重写规则无法播放MP4解决方法
I am using nginx and I have already add the line location /file/ { rewrite ^/-]+)/([-]+)/([^/]*)/([- ...
- nginx URL重写
html { font-family: sans-serif } body { margin: 0 } article,aside,details,figcaption,figure,footer,h ...
随机推荐
- selenium是如何启动浏览器的
前几天有同学问到selenium是怎么样启动浏览器的(selenium启动浏览器的原理),当时稍微讲解了一下,不过自我感觉不够具体,现在特地把启动原理通过代码和一系列操作给串联起来,希望可以帮助大家更 ...
- [转]三步完成Source Insight 4.0 破解安装
下载地址有更新,之前有朋友因潜在的版权问题封禁没下到,现在更新后可正常使用了. 文末有完全清除上次安装残留的方法,需要的人可以参考. —— 更新于 2018.1.21 第一步:安装 安装sour ...
- 并发和多线程-八面玲珑的synchronized
上篇<并发和多线程-说说面试常考平时少用的volatile>主要介绍的是volatile的可见性.原子性等特性,同时也通过一些实例简单与synchronized做了对比. 相比较volat ...
- Java线上问题排查思路及Linux常用问题分析命令学习
前言 之前线上有过一两次OOM的问题,但是每次定位问题都有点手足无措的感觉,刚好利用星期天,以测试环境为模版来学习一下Linux常用的几个排查问题的命令. 也可以帮助自己在以后的工作中快速的排查线上问 ...
- 【GMT43液晶显示模块】发布原理图、出厂代码
GMT43是一款内置4.3寸真彩液晶显示模块,其内置高速ARM Cortex-M4处 理器,主频高达180MHz,并包含丰富的外设接口. GMT43拥有丰富的资源,包含RS-232,RS-485,RS ...
- 【GMT43智能液晶模块】例程八:ADC实验——电源监控
实验原理: STM32内部集成三个12位ADC,GMT43的所有电源经过电阻分压接 入到ADC的输入通道内,输入电流经过高端电流检测芯片ZXCT1009F输入 到ADC的输入通道内,从而实现电源监控功 ...
- 【发布iCore3&iCore4ADM资料】
资料包说明: 1.解压资料包,里面有两个文件夹,iCore3和iCore4. iCore3文件夹里包含源代码及AD模块的详细资料. iCore4文件夹里仅有源代码,AD模块的详细资料参考iCore3里 ...
- Go Revel - Deployment(部署)
##概览 下面列出了部署的一些方法: 1.本地构建程序并拷贝至服务器 2.在服务器上获取更新代码,然后构建并运行 3.使用`Heroku`来管理部署 使用交互式的命令行会话来进行部署 - 通常需要一种 ...
- 块级格式化上下文( Block formatting contexts)
那么如何触发BFC呢? float 除了none以外的值 overflow 除了visible 以外的值(hidden,auto,scroll ) display (table-cell,table- ...
- MAC /usr/local 文件夹权限问题
修改文件夹权限 sudo chown -R $(whoami) /usr/local/ 如果失败提示Operation not permitted 或其他权限不足,则需要关闭Rootless Root ...