Create subdomain and set it up

I would like to create subdomain on my linode and have it online. What do i need to do in DNS manager and what on linode, setup some virtual host?

11 Replies

You need to go to your DNS and create a new A record for your subdomain. If you use Linode's DNS manager, go to Linode Manager -> DNS Manager -> Your Domain A/AAAA Records -> Add a New A Record. Type what you want the subdomain to be and your Linode's IP address. Save it.

On your Linode, you need to set up set up a virtual host in your web server software. This is done the same way that you set up the virtual host for your main domain – usually it is easiest make a copy of your main domain's vhost and adjust the copy for your subdomain, make sure it's going to be recognized by your web server software (usually done by making a link (shortcut) to your web server's sites-enabled directory if it has one), then restart your web server software. I can't give specific instructions since I don't know what web server software you use.

I did what you said, added A record and it says now

sport 178.79.145.163 Default

and my virtual host is like

ServerAdmin marko@arabba.hr

ServerName sport.arabba.hr

ServerAlias www.sport.arabba.hr

DocumentRoot /srv/www/sport/public_html/

ErrorLog /srv/www/sport/logs/error.log

CustomLog /srv/www/sport/logs/access.log combined

But when running sport.arabba.hr i get page not found, did enable the site and it is in sites-enabled. Is part of directory being only "sport" wrong, should i put sport.arabba.hr as document root, do I need to adjust some NS settings?

I see now that "I cant" setup document root to be other then the one that is set up in main domain. Like it said here

http://davidpodley.com/2010/02/11/setti … nd-apache/">http://davidpodley.com/2010/02/11/setting-up-subdomains-in-linode-and-apache/

So that was probably the problem. Is there a way to put files in any directory i want?

@marko_roi:

I did what you said, added A record and it says now

sport 178.79.145.163 Default

and my virtual host is like

ServerAdmin marko@arabba.hr

ServerName sport.arabba.hr

ServerAlias www.sport.arabba.hr

DocumentRoot /srv/www/sport/public_html/

ErrorLog /srv/www/sport/logs/error.log

CustomLog /srv/www/sport/logs/access.log combined

But when running sport.arabba.hr i get page not found, did enable the site and it is in sites-enabled. Is part of directory being only "sport" wrong, should i put sport.arabba.hr as document root, do I need to adjust some NS settings?

Did you wait until the DNS manager pushed out your changes (it pushes every 15 minutes). Then you'll want to check to make it's working on your local machine (nslookup sport.arabba.hr)

In any case, your site is working for me now I think (sorry, I don't read Croatian :) )

I changed setting to

ServerAdmin marko@arabba.hr

ServerName sport.arabba.hr

ServerAlias www.sport.arabba.hr

DocumentRoot /srv/www/arabba.hr/public_html/

ErrorLog /srv/www/arabba.hr/logs/error.log

CustomLog /srv/www/arabba.hr/logs/access.log combined

So maybe that is why its working, but wondering if i can set any document root for my subdomain? Didnt know about this 15 minutes wait.

If /srv/www/arabba.hr/public_html/ is the document root for your your main domain and you want something different for sport.arabba.hr, you'll need to give it a different document root and put whatever you want it to display in your new document root. Your document root for sport.arabba.hr needs to exist and have an index.htm, index.html, or index.php that will display something. Apache should recognize any of those three as your main page, though you should only have one (not all three).

Piki, all of that I did, maybe its a DNS problem and needs to propagate, I'll leave it for some time and see.

Possible. Depends on how often your ISP updates their DNS. Most update within a couple of hours, though a rare few will take 24+ hours.

sport.arabba.hr works for me, I'm seeing Drupal's setup page. If you want to have www.sport you need to add an A record for the www as well.

Then its due to my ISP provider to make this work, Drupal setup page is what should be shown but i still get that page not found. Thanx on help I guess tomorrow it will be working.

It was due to time taken to update. thanks on help.

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