open() "" failed (2: No such file or directory)

Ter*_*nce 4 nginx nginx-location

当我请求链接http://abc.example.com/images/default-thumbnail.jpg时,在查看日志文件输出时发生 404 错误[error] 1244#0: *1 open() "/tmp/upload-dir/images/default-thumbnail.jpg" failed (2: No such file or directory),

但实际上这个文件是有的,而且权限是777

[root@localhost nginx]# ll /tmp/upload-dir/images/default-thumbnail.jpg
-rwxrwxrwx 1 root root 7592 6?  21 2016 /tmp/upload-dir/images/default-thumbnail.jpg
Run Code Online (Sandbox Code Playgroud)

nginx配置?

server {
    charset utf-8;
    client_max_body_size 128M;
    sendfile off;

    listen 80;

    server_name abc.example.com;

    access_log  /www/abc/logs/nginx-access.log;
    error_log   /www/abc/logs/nginx-error.log;

    root /tmp/upload-dir;

    location /images/ {
        autoindex on;
        expires 30d;
    }

    location / {
        proxy_pass        http://localhost:8080;
        proxy_set_header  X-Real-IP $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Host $http_host;
    }

}
Run Code Online (Sandbox Code Playgroud)

bp *_*ang 7

正如 Terrence 所说:Nginx 别名路径不能是临时路径。例如:/tmp/**