VPS侦探论坛

 找回密码
 注册
查看: 3359|回复: 4

求教:Nginx打开目录浏览功能

[复制链接]
发表于 2017-1-5 13:32:39 | 显示全部楼层 |阅读模式

  1. server
  2.     {
  3.                 listen 443 ssl http2;
  4.         #listen [::]:80;
  5.                 ssl on;
  6.             ssl_certificate /root/ssl.crt;
  7.             ssl_certificate_key /root/ssl.key;
  8.         server_name io.io www.io.io;
  9.         index index.html index.htm index.php default.html default.htm default.php;
  10.         root  /home/wwwroot/io.io;
  11.                
  12.         location /File/ {  
  13.         alias /home/wwwroot/io.io/File/log/;
  14.         autoindex on;
  15.         autoindex_exact_size off;
  16.         autoindex_localtime on;
  17. }

  18.         #error_page   404   /404.html;
  19.         include enable-php.conf;

  20.         location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
  21.         {
  22.             expires      30d;
  23.         }

  24.         location ~ .*\.(js|css)?$
  25.         {
  26.             expires      12h;
  27.         }

  28.         location ~ /\.
  29.         {
  30.             deny all;
  31.         }

  32.         access_log off;
  33.     }
  34.         server
  35.         {
  36.                 listen 80;
  37.                 server_name io.io www.io.io;
  38.                 return 301 https://io.io$request_uri;
  39.                 }
复制代码


但是显示403
试了很多次,都不行啊!
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2017-1-5 13:34:22 | 显示全部楼层


就是我想io.io/File/log/
这个目录开启浏览功能、并且能下载一些文件
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2017-1-5 16:21:20 | 显示全部楼层

alias 指定的目录是准确的,可以理解为linux的 ln命令创建软连接,location就是软连接的名字。

所以应该是
location /File/log/ {  
        alias /home/wwwroot/io.io/File/log/;
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2017-1-12 15:18:04 | 显示全部楼层

回复 3# 的帖子




io.io/File/log/目录
403 Forbidden

[ 本帖最后由 xiaoxue 于 2017-1-12 15:21 编辑 ]
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2017-1-12 17:01:01 | 显示全部楼层

回复 4# 的帖子


可能你新的配置上有其他问题或没生效等之类的问题

军哥运维代购:http://shop63846532.taobao.com/

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-28 01:21 , Processed in 0.051326 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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