1

操作系统:Ubuntu 10.04 LTS

在 /opt 中下载并安装 Xampp for linux 1.8.1

当我转到本地主机时,我得到了标准的 xampp 起始页,一切正常,除了 phpmyadmin,我通过在 extra/httpd-xampp.conf 中添加“Required all Granted”行来修复它

# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
    AllowOverride AuthConfig Limit
    Order allow,Deny
    Allow from all
#cahg 
    Require all granted
</Directory>

我想开发多个站点,所以我使用我认为的标准方法设置了虚拟主机。

  1. 在我的 httpd.conf 文件中包含 extra/httpd-vhosts.conf
  2. 在 extra/httpd-vhosts.conf 文件中添加了一个虚拟主机容器。3.将以下内容添加到/etc/hosts文件中

    127.0.1.1 站点 1

我必须正确完成第一部分,因为它正在工作,但是当我导航到“站点 1”时,我的网络浏览器中出现以下错误

    Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403

site1
Apache/2.4.3 (Unix) OpenSSL/1.0.1c PHP/5.4.7

我的错误日志中的这个错误

[Fri Nov 16 17:14:22.481075 2012] [core:error] [pid 14465] (13)Permission denied: [client 127.0.1.1:46687] AH00035: access to / denied (filesystem path '/home/andrew/websites/site1') because search permissions are missing on a component of the path

我尝试过的解决方案是将此 Directory 块添加到我的 httpd-vhosts.conf 文件中的目录标签中,其中 /home/andrew/websites/site 作为和属性。

Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted

没有完全理解它的作用,因为它是我找到的解决方案,并且在 httpd.conf 中它指出"You must explicitly permit access to web content directories in other <Directory> blocks below."

我的问题是:允许 apache 访问我的各种虚拟主机的文件的最佳方法是什么?注意:在 httpd.conf 中用户是nobody,组设置为nogroup。

4

1 回答 1

2

首先在 httpd.conf 中将用户 nobody 更改为您的 ubuntu 用户名

然后在 httpd.conf 的末尾:

# XAMPP
Include etc/extra/httpd-xampp.conf

其次确保您的虚拟文件夹属于您的用户名(如果我的记忆有效,您必须更改 phpmyadmin 的所有权)

然后在 httpd-xampp.conf 中创建别名:

Alias /phpmyadmin "/opt/lampp/phpmyadmin"
Alias /youralias "/path/to/folder"

然后在同一个 httpd-xampp.conf 中允许目录:

<Directory "/path/to/folder">
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all
  Require all granted
</Directory>

再见403

于 2012-12-05T13:53:57.430 回答