nginx open()“”失败(2:无此类文件或目录)

m2xkgtsf  于 2023-03-17  发布在  Nginx
关注(0)|答案(2)|浏览(216)

请求链接http://abc.example.com/images/default-thumbnail.jpg时,在查看日志文件输出[error] 1244#0: *1 open() "/tmp/upload-dir/images/default-thumbnail.jpg" failed (2: No such file or directory),时出现404错误
但事实上这份文件在那里,而且授权是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配置:

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

}
2guxujil

2guxujil1#

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

fcwjkofz

fcwjkofz2#

同样的错误,但我没有文件在/temp
“/etc/nginx/已启用站点/我的项目.conf”失败(2:没有这样的文件或目录)在/etc/nginx/nginx.conf中:60”
文件my_project.conf在那里

相关问题