当我请求链接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),
但实际上这个文件就在那里,权限是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;
}
}
答案 0 :(得分:2)
正如Terrence所说:Nginx别名路径不能是临时路径。例如:/ tmp / **