【问题标题】:subdomains w/o TLD没有 TLD 的子域
【发布时间】:2008-11-25 07:33:58
【问题描述】:

如何设置没有 TLD 的子域?我在我的主配置下有这个设置

<VirtualHost *:80>
    ServerName bbs.67.777.777.777 #fake bc my server can easily be hacked ATM :(
    DocumentRoot /var/www/phpBB
</VirtualHost>

当我转到 bbs.serveripaddress 时,我收到地址未找到错误。如果我把它放在我的主配置上面它仍然不起作用但是整个站点都指向 /var/www/phpBB 而不是 /var/www (HUH!?!)

主v主机是

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
                RedirectMatch ^/$ /apache2-default/
    </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 /var/log/apache2/error.log

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

    CustomLog /var/log/apache2/access.log combined
    ServerSignature On

    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>

如果有帮助,我正在使用 apache2 的 debian 机器上。

【问题讨论】:

  • 这不是编程问题 - 更多的是系统管理员或 IT 问题。这不是这个问题的最佳论坛...

标签: apache2 subdomain


【解决方案1】:

我认为服务器名称 (bbs.67.777.777.777 ) 不会带您到任何地方 - 除非您将它添加到主机文件中...您可以 ping 该地址好吗?

如果您不需要默认值,为什么不直接将您的网站设为默认值?

【讨论】:

  • 正确,如果您只有一个 IP 地址 (67.777.777.777),您不能使用基于名称的虚拟主机。您需要某种 dns(但它可以是内部网上的 .local)。
【解决方案2】:

您不能拥有带有 IP 地址的子域。解决此问题的最佳方法是让域或免费子域(例如 no-ip)指向您的 IP 地址并为此创建一个 ServerName。请记住将域添加到您的服务器 DNS 区域。

或在您的主机文件中创建一个域并使用它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-01
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    相关资源
    最近更新 更多