Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Help With Subdomains in apache and DNS

2 views
Skip to first unread message
Message has been deleted

Rob Duval

unread,
Sep 30, 2005, 5:10:00 PM9/30/05
to

EOZyo wrote:
> Hi, I just started a few time ago to work with Apache and I found this
> tool a great way to keep my website without (lots of) limitations.
>
> My site hosts music and I would like to set subdomains for each
> language, i.e. english.mydomain.com which goes to
> www.mydomain.com/english
>
> The configuration I have typed in apache for this, it's almost the same
> configuration I've found almost everywhere, which is the following:
>
> Listen 80
>
> ServerName localhost:80
>
> <VirtualHost *>
> ServerAlias www.mydomain.com
> DocumentRoot "/www"
> ServerName www.mydomain.com
> </VirtualHost>
>
> <VirtualHost english.mydomain.com>
> DocumentRoot "/www/english"
> ServerName english.mydomain.com
> ServerAlias english.mydomain.com
> </VirtualHost>
>
> <VirtualHost lyrics.eozyo.info>
> DocumentRoot "/www/lyrics"
> ServerName lyrics.eozyo.info
> ServerAlias lyrics.eozyo.info
> </VirtualHost>
>
> I've also created the DNS entries for english.mydomain.com and
> lyrics.mydomain.com both show an "A Record" to my current IP address (I
> work with dynamic IP but I can updated it automatically every single
> time it changes, approx. every 3 days).
>
> My DNS entries are as it follows:
>
> Domain Type Class TTL Answer
>
> mydomain.com A IN 120 MY IP
> english.mydomain.com. A IN 120 MY IP
> lyrics.mydomain.com A IN 120 MY IP
>
> I've stoped making modifications to my httpd.conf cos I cannot get it
> right.
>
> Sometimes I get to work english.mydomain.com, but the www.mydomain.com,
> mydomain.com and yrics.mydomain.com display the same root director,
> i.e.:
>
> english.mydomain.com goes to /www/english/
> lyrics.mydomain.com goes to /www/english/ not to /www/lyrics/
> www.mydomain.com goes to /www/english/ not to /www/
> mydomain.com goes to /www/english/ not to /www/
>
> That's my problem, I've been looking for information for the past 3
> days and I've made hundreds of modifications and I don't seem to get it
> right, maybe this must be written in ".htaccess" file (which I'm not
> very familiar with) or in the "httpd.conf" file; at this point i'm
> totally lost, please any advise would be great and I'll really
> appreciate it.
>
> Thanks EOZyo.
>

From what I can see, your context of the Virtual Host entries in
httpd.conf are correct.

I will note that Virtual Hosts usually work with FQDN's, I'm not sure
how they work with subdomains like you're trying to set up. More info
on subdomains should be available on Apache web sites. Although, I must
say, conceptually, if your DNS is set up to point the subdomain's out as
FQDN's to an IP address, then I would think that Virtual Hosts would get
you where you're trying to go.

First off, you're correct to write these changes to httpd.conf. I've
got four different domain names running off of a single IP
address/apache server, and that's how I've got them set up.

Check this item: At the beginning of the Virtual Hosts section of
httpd.conf, ensure that you have the following line active:
NameVirtualHost *

Make sure you have any lines about Virtual Host _default commented out.

Try moving the lyrics subdomain up to the top of the list, and the
english subdomain down in the list. If there are virtual host snags,
Apache will default to the first host in the list.

Check to see if Apache is set to bind to an ip address. This should be
disabled, but it's worth a check. You'll find this in the GLOBAL
settings section. while you're there, check to make sure that apache is
in standalone server mode.

Check your log files for messages when you're trying to access the
subdomains, and getting the wrong directory. You may be able to see
something going on in there that may help.

Re-start httpd after making changes.

cheers
..rob


0 new messages