位置中的 nginx 别名 - 丢失了最后一个字符

标签 nginx

我有 nginx 配置

它的一部分

location ~ ^/api/(?<module>.+)/doc/ {
    autoindex on;
    index index.html;
    alias /home/dmac/www/hub/hub/modules/RestApi/Resources/Doc/$1;
    error_log /var/log/nginx/hub-test-error.log debug;
}

但是当我提出请求时,出现错误

2015/03/06 18:46:43 [错误] 11158#0: *1 opendir() “/home/dmac/www/hub/hub/modules/RestApi/Resources/Doc/dashboar”失败 (2:没有这样的文件或目录),客户端:127.0.0.1,服务器:hub.dev, 请求:“GET/api/dashboard/doc/HTTP/1.1”,主机:“hub.dev”

或者

2015/03/06 18:29:37 [错误] 9941#0: *1 opendir() "/home/dmac/www/hub/hub/modules/RestApi/Resources/Doc/consultan"失败 (2 :没有这样的文件或目录),客户端:127.0.0.1,服务器:hub.dev,请求:“GET/api/consultant/doc/HTTP/1.1”,主机:“hub.dev”

我尝试更改配置

    location ~ ^/api/(consultant|dashboard)/doc/ {

但错误相同。

nginx版本:nginx/1.7.10 ubuntu 14.04 x64

为什么我会出现这个错误?怎么解决呢? 你知道还有其他方法来配置 nginx 位置来处理不同的模块吗?

最佳答案

nginx版本1.7.10出现错误

在最新版本中,此错误已修复。 所以只需更新 nginx 即可。

关于位置中的 nginx 别名 - 丢失了最后一个字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28903679/

相关文章:

Zeit Now 部署的 NGINX 代理

node.js - AWS Elastic Beanstalk - NodeJS : Get certificate SSL from Letsencrypt without Beanstalk Load Balancer

nginx - 将自定义 nginx.conf 与 Chef Cookbook 结合使用

php - 调试 php 7 Xdebug 2.4.0RC3 mac os 时出现 502 Bad Gateway

php - Laravel、Docker 和 Nginx : 404 for all files in/public folder

nginx - 无法解包数据,无效状态 CLOSED

azure - Azure Kubernetes 服务的 nginx-ingress Controller 502 错误网关

php - 当访问在代理中使用 apache 和 nginx 托管的 wordpress 时重定向到 127.0.0.1

spring-mvc - 响应 header 中的日期在哪里设置?

node.js - nginx : redirect to port according to domain prefix (dynamically)