简体   繁体   English

Apache 阻止在用户空间内使用 VirtualHost? Mac OS X

[英]Apache prevents use of VirtualHost inside user space? Mac OS X

I am trying to set up a VirtualHost for some web projects I have undergoing.我正在尝试为我正在进行的一些 web 项目设置一个 VirtualHost。 To do this, I have a folder in my User account ~/Projects/ in which I place all of my projects and I want to remain like that.为此,我在我的用户帐户 ~/Projects/ 中有一个文件夹,其中放置了我的所有项目,并且我希望保持这种状态。 When I tried to create a VirtualHost under ~/Projects/ aproject /web Apache denies me access.当我尝试在 ~/Projects/ aproject /web 下创建 VirtualHost 时,Apache 拒绝我访问。

After some tries, I discovered that if I put the project under other directory than the user space (~/....) the Apache lets me create the VirtualHost that otherwise denies access.经过一些尝试,我发现如果我将项目放在用户空间(~/....)以外的其他目录下,Apache 允许我创建否则拒绝访问的 VirtualHost。

I think this problem has to do with the UserDir directive which I think prevents access to every folder in user space but the ones listed in the UserDir - in my case it is UserDir Sites - but I do not know how to circumvent this and allow Apache to serve custom user space folders.我认为这个问题与UserDir指令有关,我认为该指令阻止访问用户空间中的每个文件夹,但在UserDir中列出的文件夹 - 在我的情况下是UserDir Sites - 但我不知道如何规避这个并允许 Apache提供自定义用户空间文件夹。 Any ideas?有任何想法吗?

The directives in httpd.conf that I am trying are this ones:我正在尝试的 httpd.conf 中的指令是这样的:

<VirtualHost *:80>
DocumentRoot "/Users/myuser/Projects/myproject/web"
ServerName www.myproject.local
</VirtualHost>

<Directory "/Users/myuser/Projects/myproject/web">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

I also have set the directive NameVirtualHost *:80 in httpd.conf.我还在 httpd.conf 中设置了指令NameVirtualHost *:80 And created the appropriate directive in /etc/hosts: 127.0.0.1 www.myproject.local .并在 /etc/hosts: 127.0.0.1 www.myproject.local中创建了适当的指令。

Best regards.此致。

You may need to alter the config for your user:您可能需要为您的用户更改配置:

users/{username).conf

Then all AuthConfig to AllowOverride然后所有AuthConfigAllowOverride

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

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