VPS侦探论坛

 找回密码
 注册
查看: 4471|回复: 3

lnmp 1.2 无法下载文件 总是404错误

[复制链接]
发表于 2015-11-12 10:25:48 | 显示全部楼层 |阅读模式

在路径正常的情况下,可以访问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" -


但文件确实存在:


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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-11-12 12:53:44 | 显示全部楼层


你这配置文件改的很多错误
你写的这个很强的伪静态所有的访问全部定向到index.php,并且这个文件不存在不就肯定404
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2015-11-12 14:28:23 | 显示全部楼层

回复 2# 的帖子


那为什么js  css文件可以正常的访问呢
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2015-11-12 17:12:52 | 显示全部楼层

回复 3# 的帖子




你可以把js、css的location去掉再试试看
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-28 13:18 , Processed in 0.026807 second(s), 18 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表