Forum Moderators: phranque

Message Too Old, No Replies

Problems with Subdomain on separate server

Apache doesn't take Servername and outputs IP

         

berserka

4:16 pm on Feb 16, 2005 (gmt 0)



Hi Folks,

this is my first post here and I must admit that I'm quite a noob regarding Apache configuration.

So here is my problem:

I want to run a subdomain on a different server as the main domain:
[domain.com...] => Server A (I don't have access to this server)
[sub.domain.com...] => Server B (The server I work with)

The Subdomain (http://sub.domain.com and [sub.domain.com)...] is pointed to the IP adress of Server B, which works fine, but I can't get Apache to output the Subdomain as Servername. It always shows the IP in the adress bar.

I checked with a phpinfo() script and it seems that http_host is the IP adress and not the subdomain.

Here is the relevant part of my configuration in httpd.conf (Apache2 on Suse):


Listen 80
UseCanonicalName On
ServerName www.sub.domain.com
NameVirtualHost *
<VirtualHost *>
ServerName www.sub.domain.com
ServerAlias sub.domain.com
DocumentRoot "/var/lib/srv/www/htdocs"
DirectoryIndex index.php
<Directory "/var/lib/srv/www/htdocs">
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Is this ok? Am I missing anything important?
Are there any tricks or special settings for hosting a subdomain on a separate server?

Thanks in advance,

berserka