自定义 Apache 的位置 Mac OS X user webroot
Customizing the location of Apache Mac OS X user webroot
我在 Mac OS X 10.10 Yosemite 上安装了 PHP 运行 的内置 Apache。 localhost 和 localhost/~username 都按预期工作。
我无法正常工作的是将我的 用户名 的 webroot 移动到另一个文件夹而不是默认的 Sites在我的用户配置文件目录下。我真正想要的情况不是将它放在 /Users/username/Sites 下,而是放在 /Users/username/Development/Sites.
我的用户名.conf 在/etc/apache2/users 中看起来是这样的:
<Directory "/Users/[username]/Development/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options +Indexes +MultiViews
AllowOverride All
Require local
Order allow,deny
Allow from localhost
Require all granted
</Directory>
因此,我收到 localhost/~username 的 403 Forbidden 响应,在删除目录的 "Development" 部分时它确实可以正常工作。我在两个位置都有相同的 index.php。所有者、组和权限设置相同,如下所示;
禁止目录和工作目录的权限设置相同。
"forbidden"情况在/Users/用户名下有一个开发目录...
drwxr-xr-x 6 [user] staff 204 7 sep 22:23 Development
...下面有一个 Sites 文件夹...
drwxr-xr-x 4 [user] staff 136 7 sep 22:41 Sites
.. 包含一个 index.php
-rw-r--r--@ 1 [user] staff 21 7 sep 22:41 index.php
工作环境在/Users/username下有一个Sites目录...
drwxr-xr-x 7 [user] staff 238 11 sep 21:37 Sites
.. 包含一个 index.php
-rw-r--r--@ 1 [user] staff 21 7 sep 22:41 index.php
有人吗?
我已经升级到 El Capitan (10.11),但我认为这在 Yosemite 中同样有效。
除了开头post中的设置外,还必须编辑/etc/apache2/extra/httpd-userdir.conf。就我而言,我编辑了
UserDir Sites
进入
UserDir Development/Sites
我在 Mac OS X 10.10 Yosemite 上安装了 PHP 运行 的内置 Apache。 localhost 和 localhost/~username 都按预期工作。
我无法正常工作的是将我的 用户名 的 webroot 移动到另一个文件夹而不是默认的 Sites在我的用户配置文件目录下。我真正想要的情况不是将它放在 /Users/username/Sites 下,而是放在 /Users/username/Development/Sites.
我的用户名.conf 在/etc/apache2/users 中看起来是这样的:
<Directory "/Users/[username]/Development/Sites/">
AddLanguage en .en
LanguagePriority en fr de
ForceLanguagePriority Fallback
Options +Indexes +MultiViews
AllowOverride All
Require local
Order allow,deny
Allow from localhost
Require all granted
</Directory>
因此,我收到 localhost/~username 的 403 Forbidden 响应,在删除目录的 "Development" 部分时它确实可以正常工作。我在两个位置都有相同的 index.php。所有者、组和权限设置相同,如下所示;
禁止目录和工作目录的权限设置相同。
"forbidden"情况在/Users/用户名下有一个开发目录...
drwxr-xr-x 6 [user] staff 204 7 sep 22:23 Development
...下面有一个 Sites 文件夹...
drwxr-xr-x 4 [user] staff 136 7 sep 22:41 Sites
.. 包含一个 index.php
-rw-r--r--@ 1 [user] staff 21 7 sep 22:41 index.php
工作环境在/Users/username下有一个Sites目录...
drwxr-xr-x 7 [user] staff 238 11 sep 21:37 Sites
.. 包含一个 index.php
-rw-r--r--@ 1 [user] staff 21 7 sep 22:41 index.php
有人吗?
我已经升级到 El Capitan (10.11),但我认为这在 Yosemite 中同样有效。
除了开头post中的设置外,还必须编辑/etc/apache2/extra/httpd-userdir.conf。就我而言,我编辑了
UserDir Sites
进入
UserDir Development/Sites