VPS侦探论坛

标题: lnmp 1.2 无法下载文件 总是404错误 [打印本页]

作者: smj227227    时间: 2015-11-12 10:25
标题: lnmp 1.2 无法下载文件 总是404错误
在路径正常的情况下,可以访问js,css文件,但是doc,xls类型的文件就访问不了 例如:访问 XXX.com/resource/file/example_question.xlsx



nginx log:114.221.79.228 - - [12/Nov/2015:10:19:35 +0800] "GET /resource/file/example_question.xlsx HTTP/1.1" 404 583 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36" -


但文件确实存在:[attach]2871[/attach]


nginx 配置:



server {
listen 80;        server_name xxx.net;
index index.php;
root /home/wwwroot/default;
location ~ [^/]\.php(/|$)        {
# comment try_files $uri =404; to enable pathinfo            try_files $uri =404;            fastcgi_pass  unix:/tmp/php-cgi.sock;            fastcgi_index index.php;            include fastcgi.conf;            #proxy_ignore_client_abort on; //让代理客户端不断开            #include pathinfo.conf;                                              }
location /{                     rewrite ^.*$ /index.php last;                 }
location ~* \.php$ {                fastcgi_pass 127.0.0.1:9000;                       }
location ~* \.(ico|css|js|gif|jpe?g|png}xlsx)(\?[0-9]+)?$ {
expires max;
log_not_found off;        }
access_log  /home/wwwlogs/cpu.m370.net.log  access;}
作者: licess    时间: 2015-11-12 12:53
你这配置文件改的很多错误
你写的这个很强的伪静态所有的访问全部定向到index.php,并且这个文件不存在不就肯定404
作者: smj227227    时间: 2015-11-12 14:28
标题: 回复 2# 的帖子
那为什么js  css文件可以正常的访问呢
作者: licess    时间: 2015-11-12 17:12
标题: 回复 3# 的帖子
你可以把js、css的location去掉再试试看




欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/) Powered by Discuz! X3.4