Nginx:修订间差异
来自康健生活
| 第3行: | 第3行: | ||
* [[Linux:Nginx/安装|安装]] | * [[Linux:Nginx/安装|安装]] | ||
* [[Linux:Nginx/配置|配置]] | * [[Linux:Nginx/配置|配置]] | ||
== 参数 == | |||
{| class="wikitable" | |||
|- | |||
| [[/permanent|permanent]] || [[/redirect|redirect]] || 示例 | |||
|- | |||
| 示例 || 示例 || 示例 | |||
|- | |||
| 示例 || 示例 || 示例 | |||
|} | |||
== windows == | == windows == | ||
* [[/Windows安装|windows安装]] | * [[/Windows安装|windows安装]] | ||
2020年7月29日 (三) 17:04的版本
参数
| permanent | redirect | 示例 |
| 示例 | 示例 | 示例 |
| 示例 | 示例 | 示例 |
windows
error
- 网址 301 重定向 URL 末尾自动加斜杠,比如现在有一个接口 https://www.as**o.cn/api/search?q=自然语言处理,会变成两个请求
https://www.as**o.cn/api/search?q=自然语言处理 301 https://www.as**o.cn/api/search?q=自然语言处理/ 200
- 只需要在 nginx 的配置文件中添加
port_in_redirect off;即可。 - 参考:
- http://nginx.org/en/docs/http/ngx_http_core_module.html#absolute_redirect
- http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name_in_redirect
- http://nginx.org/en/docs/http/ngx_http_core_module.html#port_in_redirect
No categories