Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Creating subdomains
PostPosted: Thu Mar 28, 2013 9:36 pm 
Offline
Senior Newbie

Joined: Thu Mar 28, 2013 9:33 pm
Posts: 12
I need the ability to create subdomains.

ex. dog.mydomain.com

With previous providers this was easy with cpannel, now thats another story without a control panel.

Does anyone know of a quick/easy way to create subdomains?

Ive installed Webmin in hopes it had the ability to create subdomains but have not had any luck with it.

I am very new to unmanaged servers, so everything is a long process for me.


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 4:48 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
Just DNS wise? Or in your webserver? Do you use Apache? Nginx? Which OS?


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 10:07 am 
Offline
Junior Member
User avatar

Joined: Sat Jan 12, 2013 8:04 am
Posts: 36
Website: http://www.paulthomson.me
Location: Global
Hey Guys,

If I could be so rude to hijack this post as after the same information.

I'm on NGINX with Ubuntu 12.04, PHP 5.3, DNS instructions would be good for me (assuming it's via the Linode DNS manager?).

Thanks in advance,

Paul

_________________
My Website: http://www.paulthomson.me


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 10:59 am 
Offline
Junior Member

Joined: Tue Mar 05, 2013 10:06 am
Posts: 20
livefree:

You need to install the virtualmin module to webmin to be able to create subdomains easily.


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 11:36 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
livefree wrote:
Hey Guys,

If I could be so rude to hijack this post as after the same information.

I'm on NGINX with Ubuntu 12.04, PHP 5.3, DNS instructions would be good for me (assuming it's via the Linode DNS manager?).

Thanks in advance,

Paul


DNS Wise it's simply creating a new A Record, set the subdomain you want as name (if you want sub.domain.tld, use sub as value) and the IP to your Linode's IP. You can add 2, one with IPv4 IP, other with IPv6, if you set up your nginx to allow IPv6 traffic.

Nginx wise, assuming you use apt-packages,
1. copy current config, e.g.: cp /etc/nginx/sites-available/0-default /etc/nginx/sites-available/1-sub.domain.tld
2. Edit 1-sub.domain.tld, change values:
- server_name sub.domain.tld;
- access_log
- error_log
- root
^ use own values for logs/root

Do you use PHP-FPM? That might require some extra settings for the PHP Pool.


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 12:05 pm 
Offline
Senior Newbie

Joined: Thu Mar 28, 2013 9:33 pm
Posts: 12
im using apache with debian


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 2:56 pm 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
The450man: DNS wise it's the same as I said to livefree,

I use nginx, but with apache it should be about the same:
1. copy the current config, e.g. /etc/apache2/sites-available/0-default to /etc/apache2/sites-available/1-sub.domain.tld

I believe the following matters with Apache2 for stuff you need to change:

<VirtualHost sub.domain.tld>
ServerName sub.domain.tld
ServerAdmin admin@sub.domain.tld
DocumentRoot /folder/to/public/html
ErrorLog /var/log/apache2/sub.domain.tld-error.log
CustomLog /var/log/apache2/sub.domain.tld-access common


</VirtualHost>


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Fri Mar 29, 2013 9:12 pm 
Offline
Senior Newbie

Joined: Thu Mar 28, 2013 9:33 pm
Posts: 12
Thanks Nuvini!

I have Three files: default, default-ssl and mydomain.tld (has the MS-DOS application extension). I believe the MS-dos application extension was from using putty?

The other two files appeared as if they are using a wildcard *, the ms-dos one seemed to have the proper format so I copied it and edited the mydomain.tld with subdomain.mydomain.tld

As far as setting the DNS goes, do we do this within the linode manager itself? If so, how is this done? Creating a new domain zone? Master or slave?


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sat Mar 30, 2013 4:31 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
I'm not sure what you mean with the MS-DOS Extension.

After editing, I believe Apache has a built in command to enable the site: a2ensite <subdomain.mydomain.tld>
If that doesn't work, just do ln -s /etc/apache2/sites-available/sub.domain.tld /etc/apache2/sites-enabled/sub-domain.tld

DNS wise, I don't know your domain name, but you have to set it where your nameservers are located. Linode doesn't handle domain registrations, so by default you'll have to add the A-records where you registered your domain.
If you want to use the Linode DNS manager for this you have to point your domain's nameservers to ns1.linode.com to ns5.linode.com. If you can't fill in 5 nameservers, check here which ones are the best geographically and use those: https://www.linode.com/wiki/index.php/Linode_DNS (e.g. If you're in Europe, make sure to at least include ns5.linode.com)


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sat Mar 30, 2013 10:33 am 
Offline
Senior Newbie

Joined: Thu Mar 28, 2013 9:33 pm
Posts: 12
Im using linodes domain manager and have my domains nameservers pointend to the linode nameservers.

After editing, it appears the sub domain now works but it displays the content of the main domain.


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sat Mar 30, 2013 11:01 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
What does 'apache2ctl -S' report?

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sat Mar 30, 2013 7:14 pm 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
Nuvini wrote:
I'm not sure what you mean with the MS-DOS Extension.

He has a file named "mydomain.com" in the sites directory, and is using Windows, which interprets .com as the old DOS-style executable.

_________________
rsk, providing useless advice on the Internet since 2005.


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sun Mar 31, 2013 12:05 am 
Offline
Senior Newbie

Joined: Thu Mar 28, 2013 9:33 pm
Posts: 12
When i ran "apache2ctl -S" i got:

apache2: Could not reliably determine the server's fully qualified domain name, using 74.207.xxx.xxx for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost


default server www.mydomain.com (/etc/apache2/sites-enabled/mydomain.com:4)
port 80 namevhost www.mydomain.com (/etc/apache2/sites-enabled/mydomain.com:4)
port 80 namevhost www.mydomain.com (/etc/apache2/sites-enabled/sub-mydomain.com:4)
port 80 namevhost www.mydomain.com (/etc/apache2/sites-enabled/sub-mydomain.com:21)


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sun Mar 31, 2013 7:53 am 
Offline
Senior Member
User avatar

Joined: Sat Aug 30, 2008 1:55 pm
Posts: 1739
Location: Rochester, New York
It looks like you need to change ServerName for both of the <VirtualHost> stanzas in sub-mydomain.com.

_________________
Code:
/* TODO: need to add signature to posts */


Top
   
 Post subject: Re: Creating subdomains
PostPosted: Sun Mar 31, 2013 4:11 pm 
Offline
Senior Newbie

Joined: Thu Mar 28, 2013 9:33 pm
Posts: 12
I did some editing and ran apache2ctl -S again:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server http://www.mydomain.com (/etc/apache2/sites-enabled/mydomain.com:4)
port 80 namevhost http://www.mydomain.com (/etc/apache2/sites-enabled/mydomain.com:4)
port 80 namevhost sub.mydomain.com (/etc/apache2/sites-enabled/sub-(the domain name here is wrong. My domain has three characters sperated by a -, it is missing the first 4 characters).com:4)
Syntax OK

I need to edit the "sites-enabled" folder files, but I believe these are system links and not actual files. How can I edit these?

My sub domain is still redirecting to my main domain.


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


Who is online

Users browsing this forum: No registered users and 5 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