【问题标题】:Nginx picking up wrong directory from configurationNginx 从配置中获取错误的目录
【发布时间】:2021-11-12 15:37:21
【问题描述】:

我已经编写了 nginx 配置文件,但不知何故 nginx 正在寻找不存在的目录 /pipelines/videos/neuralAI.mp4 而不是寻找 /pipelines/assets/neuralAI.mp4 。任何帮助将不胜感激。

  location /videos/ {
    access_by_lua_block {
        if(ngx.var.maintenance == "on") then
            local authorize = require("authorize") 
            local maintenance = ngx.var.maintenance
            authorize.validate_access(nil, nil, "/videos", "{DEPLOYMENT}", maintenance) 
        end
    }
    root /pipelines;
    proxy_temp_path /usr/local/openresty/nginx/temp/proxy_temp;
    client_body_temp_path /usr/local/openresty/nginx/temp/client_body_temp;
    fastcgi_temp_path /usr/local/openresty/nginx/temp/fastcgi_temp;
    uwsgi_temp_path /usr/local/openresty/nginx/temp/uwsgi_temp;
    scgi_temp_path /usr/local/openresty/nginx/temp/scgi_temp;
    access_log /usr/local/openresty/nginx/logs/access.log;
    error_log /usr/local/openresty/nginx/logs/error.log;
  }

日志文件错误:

9:26:17 [error] 33#33: *11 open() "/pipelines/videos/neuralAI.mp4" failed (2: No such file or directory), client: 192.168.172.1, server: , request: "GET /videos/neuralAI.mp4 HTTP/1.1", host: "route.corp.com"

目录:

bash-4.2# pwd
/pipelines/assets
bash-4.2# ls -l 
total 26068
-rw-r--r--. 1 1000 1000 26692604 June 17 19:24 neuralAI.mp4
bash-4.2# 

谢谢

【问题讨论】:

  • 您为什么希望在/pipelines/assets 目录中搜索该文件?该配置完全按照您的要求执行。您在配置中看到任何assets 字吗?

标签: nginx nginx-reverse-proxy nginx-ingress nginx-config


【解决方案1】:

我已经使用别名而不是 root 解决了这个问题

【讨论】:

    猜你喜欢
    • 2016-11-03
    • 2016-11-29
    • 2013-09-05
    • 1970-01-01
    • 2019-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多