赞普& Apache:别名“访问被拒绝”
我刚刚在我的 Arch Linux 系统上安装了 Xampp。我现在想做的:
我的 PHP 工作目录位于我的主文件夹中(位于 /home/luke/PHP)。我希望 Apache 访问这两个文件,因此我遵循了 Xampp 安装指南 Arch Linux Wiki 并为此目录创建了一个别名。 这就是我的 httpd.conf(别名部分)的样子:
Alias /PHP /home/luke/PHP
<directory /home/luke/PHP>
AllowOverride FileInfo Limit Options Indexes
Order allow,deny
Allow from all
</directory>
之后,我将 home/luke/PHP 文件夹的权限更改为 777(使用 chmod)。我重新启动了 Xampp,当我尝试导航到 http://localhost/PHP 时,得到了 403
Apache 服务器在 http-User(存在)和http-组。因此,我在我的组中添加了 http-User(来自我的用户的 luke 组,使用 chown-tool)。我重新启动服务器,同样的错误。
这是 error_log 文件(的一部分):
[Sun Apr 24 18:05:37 2011] [error] [client 127.0.0.1] (13)Keine Berechtigung: access to /PHP/ denied
[Sun Apr 24 18:10:30 2011] [error] [client 127.0.0.1] (13)Keine Berechtigung: access to /PHP/ denied
[Sun Apr 24 18:10:30 2011] [error] [client 127.0.0.1] (13)Keine Berechtigung: access to /PHP/ denied
因此,我创建的别名应该可以工作,但是我需要做什么才能使 Apache 可以访问我的 /home/luke/PHP 文件夹服务器?
我还尝试在 htdocs 文件夹中创建符号链接,但这也不起作用。
I just installed Xampp on my Arch Linux system. What i want to do now:
My PHP working directory is located in my home-folder (at /home/luke/PHP). I want Apache to access those files two, so i followed the Xampp Installation guide on the Arch Linux Wiki and created an Alias for this Directory.
This is what my httpd.conf (the Alias part) looks like:
Alias /PHP /home/luke/PHP
<directory /home/luke/PHP>
AllowOverride FileInfo Limit Options Indexes
Order allow,deny
Allow from all
</directory>
After that, i changed the permissions for the home/luke/PHP-folder to 777 (using chmod). I restarted Xampp and got a 403 when i tried to navigate into http://localhost/PHP
The Apache-Server runs under the http-User (which exists) and the http-Group. So, i added the http-User in my Group (the group luke from my user, using the chown-tool). I restarted the Server, same error.
Here is (a part from) the error_log-file:
[Sun Apr 24 18:05:37 2011] [error] [client 127.0.0.1] (13)Keine Berechtigung: access to /PHP/ denied
[Sun Apr 24 18:10:30 2011] [error] [client 127.0.0.1] (13)Keine Berechtigung: access to /PHP/ denied
[Sun Apr 24 18:10:30 2011] [error] [client 127.0.0.1] (13)Keine Berechtigung: access to /PHP/ denied
So, the Alias I created should work, but what do I need to do to make my /home/luke/PHP-folder accessible to the Apache Server?
I also tried to create a Symlink in the htdocs-folder, but that didn't work neither.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Apache 需要能够:
通常,您必须在您的主目录上向其他人授予执行权限(这意味着他们将能够遍历该目录,转到其子目录):
当然(尤其是在多用户环境中),您必须确保其他用户无法访问您的其他目录和文件 - 通常通过删除
组< /code> 和
other
可能位于您的主目录下的目录/文件中。Apache needs to be able to :
Typically, you'll have to give the execution permission to others (which means they'll be able to traverse that directory, to go to its children), on your home directory :
Of course (especially in a multi-user environment), you'll then have to make sure that other users cannot access your other directories and files -- typically by removing all privileges that
group
andother
could have on directories/files under your home directory.我通过配置如上所示的别名来解决我的问题,但将 Apache 的用户设置为我的用户(“luke”)并保留组:
之后我更改了
htdocs
的所有者 - 和PHP
-我的用户(luke)的目录并重新启动 LAMPP。现在一切正常。还要感谢 Pascal MARTIN 和 hornetbzz!
I fixed my issue by configuring the Alias like shown above, but setting the Apache's user to my user ("luke") and leaving the Group out:
After that I changed the owner of the
htdocs
- and thePHP
-Directory to my user (luke) and restarted LAMPP.Now everything works fine. Also thanks to Pascal MARTIN and hornetbzz!