【问题标题】:Virtual Hosts on Ubuntu 10.04. -Access Forbidden Error 403Ubuntu 10.04 上的虚拟主机。 - 访问禁止错误 403
【发布时间】:2012-11-04 20:09:13
【问题描述】:

操作系统:Ubuntu 10.04 LTS

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

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

# 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

我尝试过的解决方案是将此目录块添加到我的 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 &lt;Directory&gt; blocks below."

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

【问题讨论】:

    标签: ubuntu xampp virtualhost


    【解决方案1】:

    首先在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

    【讨论】:

      猜你喜欢
      • 2015-05-24
      • 2017-09-07
      • 2012-02-11
      • 2013-07-12
      • 2015-09-16
      • 2016-11-06
      • 2015-09-16
      • 2012-09-30
      • 2015-08-26
      相关资源
      最近更新 更多