Linode.com Forum Forum Index Linode.com Forum
Linode Community Forums
 


Using domains with Linode

Click here to go to the original topic

 
       Linode.com Forum Forum Index -> General Discussion
Author Message
ngm



Joined: 14 Sep 2007
Posts: 15

Posted: Mon Mar 24, 2008 8:29 pm    Post subject: Using domains with Linode  

I bet this is a simple question, but I'm starting with servers and I need some guidance.

I registered 3 domains and I have a linode account, say:

domain1.com
domain2.com
domain3.com
my.linode.ip.number

So instead of login into my linode using Code: ssh username@my.linode.ip.number I'd like to be able to login as Code: ssh username@linode.domain1.com or Code: ssh username@linode.domain2.com

Is it possible? How?

(You don't have to explain this step-by-step, just tell me the name of this procedure and I'll google it)

Also, I want to host my 3 websites on my Linode, so I've to install Apache (and PHP and a database if applicable), right? After doing so, I do I redirect www.domain1.com to a folder on my htdocs folder (or public_html)?

Thanks for your help.
Back to top  
booja



Joined: 18 Mar 2008
Posts: 7
Location: Sydney, Australia

Posted: Mon Mar 24, 2008 9:50 pm    Post subject:  

use something like everydns.net and set an A record for linode.domain1.com

then you can just ssh in no worries

google up an apache virtual host tutorial, that will explain how to host multiple websites on one apache install
Back to top  
melancthon



Joined: 08 Feb 2008
Posts: 12

Posted: Mon Mar 24, 2008 10:00 pm    Post subject:  

I'm not quite sure why you wouldn't use Linode's own DNS manager...
Back to top  
marv



Joined: 09 Mar 2008
Posts: 9

Posted: Mon Mar 24, 2008 10:14 pm    Post subject:  

I'm not very familiar with SSH and domain so I don't know if it's possible to do what you're trying to do.

As far as setting up multiple domains with Apache, it can be different depending on which distribution you are using (the Apache syntax and declaration stay the same, but the way the files & modules are organized are different from distribution to distribution).

If you're using Ubuntu, you could do the following to add a new site:

Code:
sudo mkdir /var/www/domain1.com/
sudo nano /etc/apache2/sites-available/domain1.com


Copy and paste the following minimal virtual host configuration into /etc/apach2/sites-available/domain1.com:
Code:
<VirtualHost *>
        ServerAdmin webmaster@domain1.com
        ServerName domain1.com
        ServerAlias www.domain1.com

        DocumentRoot /var/www/domain1.com
</VirtualHost>


Then to enable the site, run:
Code:
sudo a2ensite domain1.com


Then restart Apache:
Code:
sudo /etc/init.d/apache2 restart
Back to top  
booja



Joined: 18 Mar 2008
Posts: 7
Location: Sydney, Australia

Posted: Mon Mar 24, 2008 10:19 pm    Post subject:  

melancthon wrote: I'm not quite sure why you wouldn't use Linode's own DNS manager...

well sure, you could use that too. I just already use everydns, so that's why I mentioned it.
Back to top  
ngm



Joined: 14 Sep 2007
Posts: 15

Posted: Tue Mar 25, 2008 2:09 pm    Post subject:  

Hey,

Thanks a lot for your answers, they're really helpful. (mainly marv's step-by-step guide to Apache2).

So regarding "SSH using IP" VS "SSH using mydomain", I understood that I need to use a DNS Manager, be it Linode's or a 3rd party one (maybe even my registrar have a DNS manager too, no?).

In the Cpanel of my Registrar I can create/alter the A records which points to an IP address, the CNAMES which points to a Host, MX and TXT that I won't need (no mail server). My registrar also gives me 2 nameservers (I can't change them).

On the other hand, in Linode's DNS Manager I can "Import a zone from a remote nameserver" (I'm prompted to enter a domain + namserver) and "Add a new domain zone" (I'm prompted for a domain + type: master or slave).

I don't know what to do. I think I know in theory...

I need to create a subdomain in my Registrar (CNAME) in the form linode.mydomain.com. But it must point to a host. The only host I have is @ (www) that points to the IP address of my registrar. So I think I've to create another Host, which IP is my Linode's IP.

But if the procedure is that simple, why do I need the DNS manager?

The only thing I want is to ssh username@linode.mydomain.com instead of ssh username@xxx.xxx.xxx.xxx (where the xxx.xxx.xxx.xxx is the IP address of my linode).

Thanks again.
Back to top  
SteveG



Joined: 30 Nov 2003
Posts: 220

Posted: Tue Mar 25, 2008 3:42 pm    Post subject:  

Quote: But if the procedure is that simple, why do I need the DNS manager?

DNS ("domain name system") is the way names are mapped to IPs (and vice-versa). So to get "linode.domain1.com" to map to "linode_ip", you need an entry in the DNS *somewhere*. The easiest will probably be your domain register's system. You can move it later without too much pain, if desired Anyway, the point is that without DNS records, no amount of Apache setup is going to help, because the connections will never reach the right machine.

There are several record types in DNS. The most common are A "Address" records,
which map names to IPs, and CNAME "Canonical NAME" records, which map alias names to canonical names. So, for example, you'd have an A record to map linode.domain1.com to 1.2.3.4, and a CNAME record to map www.domain.1.com to linode1.domain.1.com.

Does that clarify?
Back to top  
ngm



Joined: 14 Sep 2007
Posts: 15

Posted: Tue Mar 25, 2008 6:19 pm    Post subject:  

Hey SteveG,

Yes... I do think so.

At least, I created a new A Record in my registrar DNS Manager:

Host: server
Points to IP: my.linode.ip.number
TTL: 1hour

And now I can ssh myusername@server.mydomain.com successfully.

Despite working I hope I've done things correctly. Thanks for your patience. :?
Back to top  
SteveG



Joined: 30 Nov 2003
Posts: 220

Posted: Wed Mar 26, 2008 1:46 pm    Post subject:  

Once you're happy with the config, please go back and update your TTL to something larger, like 12 or 24 or 48 hours. Caching is a huge win for DNS, and for a static IP like linodes, there's no reason for a short TTL. (Well, when you know a change is coming, you can put in the small value again.)
Back to top  
 
       Linode.com Forum Forum Index -> General Discussion
Page 1 of 1