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 ...
随机推荐
- AutoMapper,对象映射的简单使用
using AutoMapper; using AutoMapper.Configuration; using System; using System.Collections.Generic; us ...
- 【Spark 深入学习 -09】Spark生态组件及Master节点HA
----本节内容------- 1.Spark背景介绍 2.Spark是什么 3.Spark有什么 4.Spark部署 4.1.Spark部署的2方面 4.2.Spark编译 4.3.Spark St ...
- Haproxy全透明代理
1. 系统环境搭建 操作系统Centos7 内核版本3.10 Centos7已自带TPROXY模块,不需要安装TPROXY 2. Haproxy下载,编译,安装,配置 下载地址 http://www. ...
- CodeCombat编程游戏
一. 介绍 官方网站:http://cn.codecombat.com/ 项目地址:https://github.com/codecombat/codecombat CodeCombat 是一个通过玩 ...
- python中的列表、元组、数组——是不是特别容易混淆啊??
列表: 1. 即list, 是python内置的数据类型. 它的形式是: a = [1, 2, 3, 4, 5] 2. 列表内的值是可以改变的: 即可以这样子: a[0] = 100, 把列表的 ...
- 浅析C#中的结构体和类
类和结构是 .NET Framework 中的常规类型系统的两种基本构造. 两者在本质上都属于数据结构.封装着一组总体作为一个逻辑单位的数据和行为. 数据和行为是该类或结构的"成员" ...
- rem布局在react中的应用
摘要: 前面给大家分享了一个react项目(http://www.cnblogs.com/xiyangbaixue/p/4751904.html),这次对这个项目做了一些改进,增加了rem布局和对is ...
- [IR] Concept Search and PLSA
[Topic Model]主题模型之概率潜在语义分析(Probabilistic Latent Semantic Analysis) 感觉LDA在实践中的优势其实不大,学好pLSA才是重点 阅读笔记 ...
- php 公历阴历互相转换
<?php /** * Created by PhpStorm. * User: timeless * Date: 17-3-9 * Time: 上午9:32 */ class Lunar { ...
- Java实现五子棋
代码: package com.hotusm.datastructure.list; import com.hotusm.datastructure.Log; /** * @author luqiba ...