【问题标题】:Nginx, show the folder tree, virtualhostNginx,显示文件夹树,虚拟主机
【发布时间】:2017-09-24 00:43:01
【问题描述】:

我想从包含我已安装的 CMS 日志的数据文件夹中显示文件夹树。 这是我在 /etc/nginx/sites-available/ 中的数据文件

server{
        listen 80;
#       listen *:80;
        server_name datas.test.nx;
        location / {
                root /opt/datas/logs;
        }
}

但是当我进入 datas.test.nx 时,出现错误 403 Forbidden。我试图显示我放入 /home/user/index.html 的 index.html 并且它可以工作,但是当我想显示 datas/logs 的文件夹树时出现此错误。 我把 chmod 777 放在我所有的文件夹 /datas/* 和一个 chown www-data:www-data /datas/* 上。 你有什么想法吗?谢谢。

【问题讨论】:

  • 在目录列表中?

标签: nginx tree virtualhost http-status-code-403


【解决方案1】:

您需要启用目录列表。 https://nginx.org/en/docs/http/ngx_http_autoindex_module.html

server{
    listen 80;
    server_name datas.test.nx;
    root /opt/datas/logs;
    location / {
         autoindex on;
    }
}

【讨论】:

  • 非常感谢!
猜你喜欢
  • 2014-11-12
  • 1970-01-01
  • 2014-01-31
  • 1970-01-01
  • 2016-05-12
  • 2013-09-18
  • 2011-05-31
  • 2017-09-15
  • 2013-03-28
相关资源
最近更新 更多