Nginx:example.com 有效; example.com/folder 收到 403 Forbidden
我刚刚第一次设置 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/www
和 usr/share/nginx/www/store
(以及其中包含的 ISO 文件)都具有权限 drwxr-xr -x
且归 root root
所有。 Samba 服务器工作正常,我可以从另一台计算机完全访问 /store
,但无法从浏览器访问它。
有什么想法吗?
I just set up Nginx for the first time, having liked what I read about its advantages over Apache.
My problem is this: I start up Nginx on my Linux Mint (12, 32-bit) box. index.html
is located at
/usr/share/nginx/www
I also have a folder located at
/usr/share/nginx/www/store
which contains some ISO files, but no html files (so there is not even an index.html). In Apache, this would result in a folder directory, and I'm hoping to get something similar from Nginx -- I thought that was a basic functionality feature.
It is worth noting that
/usr/share/nginx/www/store
is a mounting point that I use for a Samba share.
Here's the problem:
I go to access my Linux box from my other machine. By going to www.example.com
, I am greeted with the standard "Welcome to nginx" message. When I go to www.example.com/store
, I get a "403 Forbidden" error instead of a directory listing of the files in /store
.
I've read lots about permissions being the cause of 403 errors, but I don't see how I could've missed anything. In mild desperation, I edited nginx.conf to say
user root;
so nginx is running as root, even though I know that's not the best idea (I just wanted to see if it was a permissions issue). Both usr/share/nginx/www
and usr/share/nginx/www/store
(as well as the ISO files contained therein) have permissions drwxr-xr-x
and are owned by root root
. The Samba server works just fine, and I have full access to /store
from my other computer, but I can't get at it from a browser.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在 nginx 服务器配置中将 autoindex 配置设置为“on”。例如:
默认情况下该值为 OFF
参考:http://wiki.nginx.org/HttpAutoindexModule
You need to set the autoindex configuration to 'on' in the nginx server configuration. Ex:
By default the value is OFF
Ref: http://wiki.nginx.org/HttpAutoindexModule