Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Subdomains
PostPosted: Tue Nov 11, 2003 6:16 pm 
Offline
Senior Newbie

Joined: Sat Oct 25, 2003 7:09 am
Posts: 6
Website: http://www.phonepiks.com
WLM: msn@phonepiks.com
AOL: Phonepiks
Location: UK
Hi guys,
I'm looking into setting up subdomains on my site & was really after some pointers.

Can I just edit apache's config to point the subdomain to a set directory or will I need to mess about with DNS?

Apologies for the noob posting!

Fully.

_________________
www.phonepiks.com
The Camera Phone Gallery


Top
   
 Post subject:
PostPosted: Tue Nov 11, 2003 6:53 pm 
Offline
Senior Member
User avatar

Joined: Mon Jun 23, 2003 1:25 pm
Posts: 260
Hi,

You will need to set another vhost is the apache conf file and then add an A record to the DNS record.

Adam


Top
   
 Post subject:
PostPosted: Tue Nov 11, 2003 6:53 pm 
Offline
Junior Member

Joined: Sun Jul 27, 2003 7:24 pm
Posts: 42
Website: http://opencurve.org/~sunny
Location: New York, NY
You need to do a little messing with DNS.

If you don't really know too much about DNS, check to see if your registrar supports subdomains .. or your current domain name service provider supports them. (like a web-interface or something)

If they don't, transfer your DNS to zoneedit.com (great and free), and then can easily deal with subdomains and such.

Basically you need to create a subdomain and point it to an IP.

After you have done such, you need to setup apache to deal with subdomains (the following is an example)
Code:
#
# Use name-based virtual hosting.
#
NameVirtualHost 12.13.14.15

<VirtualHost 12.13.14.15>
        ServerAdmin webmaster@domain.com
        DocumentRoot /usr/www/htdocs
        ServerName sub.domain.com
        ServerAlias www.sub.domain.com
        ErrorLog /usr/www/logs/error_log
        CustomLog /usr/www/logs/access_log common
        UserDir enabled jack
        # this would be for something like http://sub.domain.com/~jack
</VirtualHost>


HTH

Sunny Dubey


Top
   
 Post subject:
PostPosted: Tue Nov 11, 2003 7:31 pm 
Offline
Linode Staff
User avatar

Joined: Fri Oct 17, 2003 12:38 am
Posts: 287
Location: Dr Wierd's Lab, South Jersey Shore
As for the DNS side of things depending on who your DNS is through you can most likely set a wildcard record. This points *.yourdomain.com at your Linode's IP. That way when you need to add another virtual host in the furture, you just edit the apache config, restart it and you are in business.


Top
   
PostPosted: Tue Nov 11, 2003 10:25 pm 
Offline
Senior Member

Joined: Sun Nov 02, 2003 2:05 pm
Posts: 58
Linode has reverse dns which great on your page. Just point it to your domain after you point your domain to your linode ip


Top
   
 Post subject:
PostPosted: Tue Nov 11, 2003 11:37 pm 
Offline
Linode Staff
User avatar

Joined: Fri Oct 17, 2003 12:38 am
Posts: 287
Location: Dr Wierd's Lab, South Jersey Shore
I am missing the connection between reverse dns and subdomains.


Top
   
 Post subject:
PostPosted: Wed Nov 12, 2003 12:41 am 
Offline
Linode Staff
User avatar

Joined: Tue Apr 15, 2003 6:24 pm
Posts: 3090
Website: http://www.linode.com/
Location: Galloway, NJ
There is none, but Linode rocks just for having such a feature.

-Chris


Top
   
 Post subject:
PostPosted: Wed Nov 12, 2003 10:12 am 
Offline
Linode Staff
User avatar

Joined: Fri Oct 17, 2003 12:38 am
Posts: 287
Location: Dr Wierd's Lab, South Jersey Shore
caker++
caker++


Top
   
 Post subject:
PostPosted: Thu Nov 13, 2003 3:49 am 
Offline
Senior Newbie

Joined: Sat Oct 25, 2003 7:09 am
Posts: 6
Website: http://www.phonepiks.com
WLM: msn@phonepiks.com
AOL: Phonepiks
Location: UK
caker indeed!

Thanks for all the advice guys. Looks like the * bit in my dns was all I needed :D

Weird how I didn't use that in the Cpanel account I run yet subdomains came online instantly.. sounds like Voodoo to me :)

Thanks again.
Fully

_________________
www.phonepiks.com

The Camera Phone Gallery


Top
   
 Post subject:
PostPosted: Thu Nov 13, 2003 6:42 am 
Offline
Junior Member

Joined: Sun Jul 27, 2003 7:24 pm
Posts: 42
Website: http://opencurve.org/~sunny
Location: New York, NY
There is one thing to watch out for when using wild card domain names. Whatever is your first virtual host becomes your defualt virtual host.

Meaning if I were to go to: kjsht5.domain.com or w24ksrg.domain.com I will get the first virtual host apache is serving up.

Therefore it is suggested that first virtual host be a dummy virtual host, which an error of "Domain not configured" or something similar. httpd -S will show you how your virtual hosts are configured.

Sunny Dubey


Top
   
 Post subject:
PostPosted: Thu Nov 13, 2003 10:46 am 
Offline
Senior Member

Joined: Sun Nov 02, 2003 2:05 pm
Posts: 58
I was given the idea the using the reverse dns is what gives you the vhost. I tried it and looks like it works on my psybnc. I would think it would be the samething as virual host.

I maybe off base. Just trying offer alittle bit help back to you guys.

Sorry if i wrong giving out bad advise(my bust).


Top
   
 Post subject: straightening out
PostPosted: Thu Nov 13, 2003 11:49 am 
Offline
Senior Member
User avatar

Joined: Mon Sep 08, 2003 4:49 pm
Posts: 62
Location: Bucharest
You seem to have gotten mixed up somehow about the relationship between DNS, Reverse DNS, and web server virtual hosts.

First of all, know that Reverse DNS lookups are a specific kind of DNS lookup, and that they have absolutely nothing to do with making web server vhosts work. I'll explain more about what they are good for at the end.

You can configure your web server with all the vhosts you want. A vhost for www.yourdomain.com, a vhost for www.linode.com, a vhost for ha.ha.ha.ha....... but no web browser will ever see those websites unless those names 1) exist in DNS and 2) resolve to your server's IP address.

Right now, let's pretend that I have my web server configured with a vhost for www.linode.com. What happens you enter http://www.linode.com/ into your browser? Your browser looks up that name and connects to that server, and guess what... it's not my server. The name does not resolve to my IP address.

Right now, I actually do have a vhost for http://state.gov.zz/. Try clicking on that link. What happens? Nothing, because your browser cannot resolve that name. As far as your web browser knows, it doesn't exist.

So in order for web browsers to find your web server, the name has to exist in DNS, and it has to resolve to your IP address. Once that's all set, your web server will actually receive connections when people enter the name into their browsers.

Now let's look at the opposite situation. Let's say you've got DNS all set up, and your web server is running, but you don't have a vhost for the name. What happens when a browser requests something from that website? Your web server has to send something, so what it does is it searches the list of vhosts, finds that none match, and then goes back to the first one on the list and serves the content from that vhost. That's why people like me always create a default vhost and put it first in the configuration, and then create subsequent vhosts for each real domain that the server is supposed to serve.

Basically, in order for a web server virtual host to work, both need to be set up.

Now, Reverse DNS is a different business. It's generally only used for logging or displaying client connections. For example, if you were to run a web browser on your linode and connect to my web server, my web server would have your IP address. However, my web server will try to do a reverse lookup to get the hostname, so that it can write that to the log instead of the IP address. The same sort of thing happens when you connect to IRC. The IRC server does a reverse lookup to get your hostname as uses that in your hostmask instead of the IP address. Having reverse DNS set to your own hostname vs. the default generally doesn't actually make anything work any differently. There are exceptions, but you can safely ignore them.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group