简体   繁体   English

在运行Apache 2.4的osx 10.10中,在localhost / username中,“随机”禁止某些页面,而现在则禁止其他页面

[英]In osx 10.10 running Apache 2.4, in localhost/username some pages are “randomly” forbidden while others are now

I have set up a webserver for the first time. 我是第一次设置网络服务器。

When I type http://localhost/yaniv/index.html in the browser, the page loads perfectly. 当我在浏览器中输入http://localhost/yaniv/index.html时,该页面将完美加载。 When I do the same with register.html also, no problem, but many other files, like "profile.html" and many other return an error: 当我也对register.html进行相同操作时,没问题,但是许多其他文件(例如“ profile.html”和其他许多文件)返回错误:

Permission denied. 没有权限。

This is my user.conf file 这是我的user.conf文件

<Directory "/Users/yaniv/Sites/">
 Options Indexes MultiViews
 AllowOverride All
 # OSX 10.10 / Apache 2.4
 Require all granted
</Directory>

How can I fix this? 我怎样才能解决这个问题?

Most likely this is a permission issue on file system level. 这很可能是文件系统级别的权限问题。

Keep in mind that the http server process is executed under a specific user account. 请记住,http服务器进程是在特定用户帐户下执行的。 That account requires access to the files, typically read access. 该帐户需要访问文件,通常是读取访问权限。 It is easy to miss that step when you create files using an ordinary user account. 使用普通用户帐户创建文件时,很容易错过该步骤。

A typical solution on unixoid systems (so Mac OS too) is to use group permissions. 在unixoid系统上(也是Mac OS)的典型解决方案是使用组权限。 You you assign all the files to the group the http server account belongs to and grant group read access to all files. 您将所有文件分配给http服务器帐户所属的组,并授予组对所有文件的读取访问权限。 You can "automate" this by means of the umask feature in modern shells. 您可以通过现代shell中的umask功能“自动”执行此操作。 You can read about that in the man pages (if you have them installed). 您可以在手册页中阅读(如果已安装)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM