Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

When I request a link http://abc.example.com/images/default-thumbnail.jpg a 404 error occurs while seeing the log file output [error] 1244#0: *1 open() "/tmp/upload-dir/images/default-thumbnail.jpg" failed (2: No such file or directory),

But in fact this file is there,And the authority is 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

Nginx configuration:

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;
    }

}
like image 418
Terrence Avatar asked Feb 05 '23 14:02

Terrence


1 Answers

As Terrence said: Nginx alias path Cannot be a temporary path. eg:/tmp/**

like image 51
bp zhang Avatar answered Feb 12 '23 22:02

bp zhang