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

发布于 2024-11-13 08:55:46 字数 928 浏览 3 评论 0原文

我正在尝试为我正在进行的一些网络项目设置一个虚拟主机。为此,我在我的用户帐户 ~/Projects/ 中有一个文件夹,其中放置了所有项目,并且我希望保持这种状态。当我尝试在 ~/Projects/aproject/web 下创建 VirtualHost 时,Apache 拒绝我访问。

经过一番尝试,我发现如果我将项目放在用户空间 (~/....) 之外的其他目录下,Apache 会让我创建 VirtualHost,否则将拒绝访问。

我认为这个问题与 UserDir 指令有关,我认为该指令阻止访问用户空间中的每个文件夹,但 UserDir 中列出的文件夹 - 在我的情况下它是 < code>UserDir Sites - 但我不知道如何规避此问题并允许 Apache 提供自定义用户空间文件夹。有什么想法吗?

我正在尝试的 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>

我还在 httpd.conf 中设置了指令 NameVirtualHost *:80 。 并在 /etc/hosts 中创建适当的指令:127.0.0.1 www.myproject.local

此致。

I am trying to set up a VirtualHost for some web projects I have undergoing. 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. When I tried to create a VirtualHost under ~/Projects/aproject/web Apache denies me access.

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.

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. Any ideas?

The directives in httpd.conf that I am trying are this ones:

<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.
And created the appropriate directive in /etc/hosts: 127.0.0.1 www.myproject.local.

Best regards.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2024-11-20 08:55:46

您可能需要更改用户的配置:

users/{username).conf

然后将所有 AuthConfig 更改为 AllowOverride

You may need to alter the config for your user:

users/{username).conf

Then all AuthConfig to AllowOverride

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文