没有顶级域名的子域名

时间:2008-11-25 07:33:58

标签: apache2 subdomain

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

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

当我转到bbs.serveripaddress时,我收到一个Address Not Found错误。如果我把它放在我的主配置上面它仍然无法工作,但整个网站指向/ 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框。

2 个答案:

答案 0 :(得分:1)

我认为服务器名称(bbs.67.777.777.777)不会让你到任何地方 - 除非你把它添加到你的主机文件中......你能ping那个地址吗?

为什么不将您的网站设为默认网站...如果您不需要默认设置?

答案 1 :(得分:0)

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

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