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

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

请求链接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

  1. [root@localhost nginx]# ll /tmp/upload-dir/images/default-thumbnail.jpg
  2. -rwxrwxrwx 1 root root 7592 6 21 2016 /tmp/upload-dir/images/default-thumbnail.jpg

Nginx配置:

  1. server {
  2. charset utf-8;
  3. client_max_body_size 128M;
  4. sendfile off;
  5. listen 80;
  6. server_name abc.example.com;
  7. access_log /www/abc/logs/nginx-access.log;
  8. error_log /www/abc/logs/nginx-error.log;
  9. root /tmp/upload-dir;
  10. location /images/ {
  11. autoindex on;
  12. expires 30d;
  13. }
  14. location / {
  15. proxy_pass http://localhost:8080;
  16. proxy_set_header X-Real-IP $remote_addr;
  17. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  18. proxy_set_header Host $http_host;
  19. }
  20. }
2guxujil

2guxujil1#

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

fcwjkofz

fcwjkofz2#

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

相关问题