VPS侦探论坛

 找回密码
 注册
查看: 4714|回复: 1

军哥,请教一下,目录下文件访问出现403是怎么回事?

[复制链接]
发表于 2014-11-20 16:55:00 | 显示全部楼层 |阅读模式

设置了伪静态访问网站目录下面的html、php、图片正常,
访问favicon.ico文件都会出现403
我想在目录下面直接放zip文件,访问出现也是403,不会出现下载。
请军哥提示一下。谢谢
  1. server
  2.         {
  3.                 listen 80;
  4.                 #listen [::]:80;
  5.                 server_name www.www.com;
  6.                
  7.                 index index.html index.htm index.php default.html default.htm default.php;
  8.                 root  /home/wwwroot/www.www.com/;

  9.                
  10.                 error_page   404   /404.html;

  11.                if (!-e $request_filename) {
  12.                  rewrite ^(.*)$ /index.php?s=/$1 last;
  13.                  }
  14.                 location ~ [^/]\.php(/|$)
  15.                         {
  16.                                 # comment try_files $uri =404; to enable pathinfo
  17.                                 try_files $uri =404;
  18.                                 fastcgi_pass  unix:/tmp/php-cgi.sock;
  19.                                 fastcgi_index index.php;
  20.                                 include fastcgi.conf;
  21.                                 #include pathinfo.conf;
  22.                         }

  23.                 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  24.                         {
  25.                                 expires      30d;

  26.                         }

  27.                 location ~ .*\.(js|css)?$
  28.                         {
  29.                                 expires      12h;
  30.                         }
  31.         location /
  32.         {
  33.         if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx|apk|ico)$)
  34.         {
  35.         add_header Content-Disposition: 'attachment;';
  36.         }
  37.         }
  38.                 access_log  /home/wwwlogs/www.www.com.log  access;
  39.         }
  40.        
  41. server
  42.         {
  43.         server_name www.com;
  44.         return 301 $scheme://www.www.com$request_uri;
  45.         }
复制代码
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2014-11-20 19:08:07 | 显示全部楼层


你自己加的
  1.         location /
  2.         {
  3.         if ($request_filename ~* ^.*?\.(txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx|apk|ico)$)
  4.         {
  5.         add_header Content-Disposition: 'attachment;';
  6.         }
复制代码
这一段的问题吧
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-25 03:28 , Processed in 0.025423 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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