java - nginx.conf 中的“location /logs”和“location /logs/”有什么区别
问题描述
我需要知道nginx.conf中以下两行之间的区别。以及它们的用例。
位置/日志{
位置/日志/ {
解决方案
这在http://nginx.org/en/docs/http/ngx_http_core_module.html#location的位置文档中有介绍
如果位置由以斜杠字符结尾的前缀字符串定义,并且请求由 proxy_pass、fastcgi_pass、uwsgi_pass、scgi_pass、memcached_pass 或 grpc_pass 之一处理,则执行特殊处理。为了响应 URI 等于此字符串但没有尾部斜杠的请求,将返回带有代码 301 的永久重定向到附加斜杠的请求 URI。如果不希望这样,可以像这样定义 URI 和位置的精确匹配:
location /user/ {
proxy_pass http://user.example.com;
}
location = /user {
proxy_pass http://login.example.com;
}
我希望这会有所帮助。
推荐阅读
- android - 为什么向 build.gradle 添加存储库会使其找不到依赖项?
- python - Python 在许多用户输入上运行计算
- python - python在excel文件中写入时出现错误
- .net-core - 如何在我的 Blazor 应用程序中将单选按钮标记为“已选中”,同时在 foreach 循环内创建单选按钮?
- selenium - Selenium 4 + geckodriver:使用 Page.printToPDF 将网页打印到 PDF
- mongodb - 使用 GoLang 从 MongoDB 读取文档
- python - Python 遍历行并更新 SQL Server 表
- python - 使用 Notebook tkinter 的不同选项卡
- javascript - 如何使用节点js、react js、sql中的会话以表格格式显示登录的用户详细信息?
- javascript - 根据其中一个属性的最大值从对象数组中获取一个对象