permissions - Nginx:example.com 有效; example.com/folder 得到 403 Forbidden

标签 permissions nginx http-status-code-403

我刚刚第一次设置 Nginx,喜欢我读到的关于它优于 Apache 的内容。

我的问题是:我在我的 Linux Mint(12、32 位)机器上启动了 Nginx。 index.html 位于

/usr/share/nginx/www

我还有一个文件夹位于

/usr/share/nginx/www/store

其中包含一些 ISO 文件,但没有 html 文件(因此甚至没有 index.html)。在 Apache 中,这将产生一个文件夹目录,我希望从 Nginx 中得到类似的东西——我认为这是一个基本的功能特性。

值得注意的是

/usr/share/nginx/www/store

是我用于 Samba 共享的挂载点。

问题是:

我从我的另一台机器上访问我的 Linux 机器。通过访问 www.example.com,我收到了标准的“欢迎使用 nginx”消息。当我转到 www.example.com/store 时,我收到“403 Forbidden”错误,而不是 /store 中文件的目录列表。

我读过很多关于权限是导致 403 错误的原因的文章,但我不明白我怎么可能错过任何内容。无奈之下,我编辑了 nginx.conf 说

user root;

所以 nginx 以 root 身份运行,尽管我知道这不是最好的主意(我只是想看看这是否是权限问题)。 usr/share/nginx/wwwusr/share/nginx/www/store(以及其中包含的 ISO 文件)都具有权限 drwxr-xr -x 并且归 root root 所有。 Samba 服务器运行良好,我可以从我的另一台计算机完全访问 /store,但我无法从浏览器访问它。

有什么想法吗?

最佳答案

您需要在 nginx 服务器配置中将 autoindex 配置设置为 'on'。例如:

location  /  {
  autoindex  on;
}

默认值为OFF

引用:http://wiki.nginx.org/HttpAutoindexModule

关于permissions - Nginx:example.com 有效; example.com/folder 得到 403 Forbidden,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9206158/

相关文章:

python - Matplotlib Savefig 不会覆盖旧文件

ubuntu - VirtualBox Ubuntu 客户机上的 nginx 提供过时的内容

Spring WebSocket 使用 SockJS 连接到不同的域

azure - 从另一个 Azure 函数调用一个 Azure 函数时出现 403(禁止)

json - `npm install` 运行时在主目录写入文件

java - 如何以 root 身份启动 Java 程序但降级为非 root 用户

AngularJS 不适用于第三方预渲染服务

exchange-server - Office365 autodiscover.xml 返回 403 Forbidden

python - 限制(许可)Django 员工用户更改模型的某些字段

带有嵌套符号链接(symbolic link)的 Nginx 根目录