尝试在 Apache2 上设置子域名,但无法获取子域名

尝试在 Apache2 上设置子域名,但无法获取子域名

我正在尝试在 Apache2 中设置子域,我在 www 文件夹中有两个文件夹,ankurkaushal 和 owncloud。我想为 owncloud 创建子域。

我的服务器有一个专用 IP 地址,并且也在注册商端设置了 A 记录。

每当我尝试访问 owncloud.ankurkaushal.me 时,我都会发现 owncloud.ankurkaushal.me 不可用。

这是我的站点可用/默认文件:

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerAlias ankurkaushal.me
    DocumentRoot /var/www/ankurkaushal/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/ankurkaushal/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

#Owncloud

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName  owncloud.ankurkaushal.me
    ServerAlias owncloud.ankurkaushal.me
    DocumentRoot /var/www/owncloud/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/owncloud/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

这是最新的错误日志

[Sun Aug 25 02:25:30 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.7 with Suhosin-Patch configured -- resuming normal operations
[Sun Aug 25 02:26:57 2013] [error] [client 24.212.255.66] File does not exist: /var/www/ankurkaushal/owncloud, referer: http://144.76.93.122/owncloud/

有人能帮助我解决这个问题吗?

答案1

正如评论所暗示的那样,您的 DNS 无法解析此子域。通过 dnsstuff.com 快速查找可得到以下结果:

Target  owncloud.ankurkaushal.me  
Timeout Value   1 (default)  
Your Overall Score  Lookup failed  

如果您已将 A 记录添加到 Namecheap 的区域文件,请在尝试访问此子域之前给 DNS 传播一些时间来完成。

相关内容