【问题标题】:vhost on ubuntu with xampp does not work带有 xampp 的 ubuntu 上的虚拟主机不起作用
【发布时间】:2014-05-30 12:37:17
【问题描述】:

我全新安装了 ubuntu 并安装了 xampp。如果我在浏览器中输入“localhost”,则会出现正确的 XAMPP 页面。

现在我想将 htdocs 文件夹更改为“/home/adam/Web/mydomain.de”。 因此,我在 /opt/lamp 中取消了“包含 etc/extra/httpd-default.conf”的注释。 p/etc/httpd.conf 和我添加了

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/home/adam/Web/mydomain.de"
    ServerName mydomain.de
    ServerAlias www.mydomain.de
    ErrorLog "logs/mydomain.de-error_log"
    CustomLog "logs/mydomain.de-access_log" common
</VirtualHost>

到 /opt/lampp/etc/extra/httpd-vhost.conf 。

如果我在浏览器中输入“www.mydomain.de”,我会得到:

禁止访问!

您无权访问请求的目录。没有索引文档或目录被读保护。

但是有一个 index.php 文件,文件夹 Web 和所有子目录都有 chmod 777 并且我也被设置为这些文件的所有者 - 为什么它不起作用?另外,当我将代码更改为

<VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "/opt/lampp/htdocs"
        ServerName mydomain.de
        ServerAlias www.mydomain.de
        ErrorLog "logs/mydomain.de-error_log"
        CustomLog "logs/mydomain.de-access_log" common
    </VirtualHost>

然后“www.mydomain.de”再次返回预期的 XAMPP 页面。因此,出于某种原因,我的文件夹看起来确实没有读取权限 - 即使它具有正确的权限。怎么了?

【问题讨论】:

    标签: ubuntu xampp


    【解决方案1】:

    这行得通:

    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "/home/adam/Web/mydomain.de"
        ServerName mydomain.de
        ServerAlias www.mydomain.de
        ErrorLog "logs/mydomain.de-error_log"
        CustomLog "logs/mydomain.de-access_log" common
    
        <Directory "/home/adam/Web/mydomain.de" >
            Options All
            AllowOverride All
            Require all granted
        </Directory>
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 2016-10-23
      • 2012-06-08
      • 2013-07-29
      • 2014-08-02
      • 1970-01-01
      • 2011-04-26
      • 2016-11-01
      • 2016-11-27
      • 2013-09-11
      相关资源
      最近更新 更多