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 ssh username@my.linode.ip.number I'd like to be able to login as ssh username@linode.domain1.com or 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.

8 Replies

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

I'm not quite sure why you wouldn't use Linode's own DNS manager…

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:

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:

 <virtualhost *="">ServerAdmin webmaster@domain1.com
        ServerName domain1.com
        ServerAlias www.domain1.com

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

Then to enable the site, run:

sudo a2ensite domain1.com

Then restart Apache:

sudo /etc/init.d/apache2 restart

@melancthon:

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.

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.

> 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?

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. :?

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.)

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct