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

14,952

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

Share:
14,952
Terrence
Author by

Terrence

Updated on June 04, 2022

Comments

  • Terrence
    Terrence almost 2 years

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