【问题标题】:Apache2 - Trouble Adding SubdomainApache2 - 添加子域时遇到问题
【发布时间】:2013-03-11 18:54:38
【问题描述】:

我有一个运行 Ubuntu 11 和 Apache2 的 Linode 服务器,我正在尝试让一个子域正常工作。这是我在sites-available 文件夹中的mywebsite 文件。我尝试将顶部放在它自己的文件testing.mywebsite 中并重新加载 apache2,但没有成功。

<VirtualHost *:80>
    DocumentRoot /home/user2/www
    ServerName testing.mywebsite.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin email@gmail.com
    ServerName  mywebsite.com
    ServerAlias *.mywebsite.com
    ServerAlias 192.155.90.135

    #Index file and Document Root (where the public files are located)
    DirectoryIndex  index.html index.php
    DocumentRoot    /home/user/public/mywebsite/www

    #Log file locations
    LogLevel    warn
    ErrorLog    /home/user/public/mywebsite/log/error.log
    CustomLog   /home/user/public/mywebsite/log/access.log combined
</VirtualHost>

我有一个网站正在运行,apache 可以找到/home/user/public/mywebsite/www 中的所有文件,但是当我转到测试子域时,我的浏览器找不到它。我对 apache2 非常陌生,因此不胜感激。谢谢。

【问题讨论】:

    标签: linux apache webserver subdomain virtualhost


    【解决方案1】:

    您的 DNS 记录是否配置为在解析时将您的计算机指向所需的主机名和服务器的 IP 地址?或者,您是否在编辑 /etc/hosts

    我有点不确定“我的浏览器找不到它”是什么意思,因此请澄清上述问题是否无法让您更接近您的问题。值得在您指定的路径和 /var/log/apache2/ 中检查 Apache 的日志文件。

    【讨论】:

    • 我没有覆盖 /etc/hosts 中的任何内容,但我忘记了 DNS 是在 Linode 网站上管理的。我设置了一个新的 A 记录,希望能解决这个问题。谢谢。
    猜你喜欢
    • 2017-09-09
    • 2018-12-02
    • 1970-01-01
    • 2020-09-15
    • 2017-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多