Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Feb 12, 2010 2:20 pm 
Offline
Senior Newbie

Joined: Fri Feb 12, 2010 2:14 pm
Posts: 6
Trying to get subdomains working. I have DNS set up in Linode for my domain itsbetterintheoven.com, for sub.itsbetterintheoven.com. It's set up to go to the main IP address, and shows up as doing so:

Code:
host sub.itsbetterintheoven.com
shows 72.14.188.138, as it should.

On the server side, in addition to my file for the main domain, I have sub.itsbetterintheoven.com with the following information:

Code:
<VirtualHost 72.14.188.138:80>
  ServerAdmin myemail@address.com
  ServerName sub.itsbetterintheoven.com
  ServerAlias www.sub.itsbetterintheoven.com
  DocumentRoot /srv/www/sub.itsbetterintheoven.com/public_html
  ErrorLog /srv/www/sub.itsbetterintheoven.com/logs/error.log
  CustomLog /srv/www/itsbetterintheoven.com/logs/access.log combined
</VirtualHost>


I've run a2ensite on the file, and I've restarted apache. What gives?


Top
   
 Post subject:
PostPosted: Sat Feb 13, 2010 9:12 am 
Offline
Senior Member
User avatar

Joined: Tue Nov 24, 2009 1:59 pm
Posts: 362
>.>
You seem to be confusing IP-based virtualhosts with name-based virtualhosts... which happens often, for they're counterintuitive.

IP-based vhosts:
Code:
<VirtualHost 1.1.1.1:80> 
  ServerAdmin myemail@address.com
  ServerName example.com
  ServerAlias www.example.com
  # DocumentRoot, logs, whatever
</VirtualHost>
<VirtualHost 2.2.2.2:80>
  ServerAdmin myemail@address.com
  ServerName sub.example.com
  ServerAlias www.sub.example.com
  # DocumentRoot, logs, whatever
</VirtualHost>

Name-based vhosts
Code:
NameVirtualHost *:80
<VirtualHost *:80>
  # First namevhost for this IP(or wildcard), will be selected
  # if the user agent did not supplied Host: header
  ServerAdmin myemail@address.com
  ServerName example.com
  ServerAlias www.example.com
  # DocumentRoot, logs, whatever
</VirtualHost>
<VirtualHost *:80>
  ServerAdmin myemail@address.com
  ServerName sub.example.com
  ServerAlias www.sub.example.com
  # DocumentRoot, logs, whatever
</VirtualHost>

Or, instead of *:80 you can specify one, and the same IP for a name vhost group, so you can have some namevhosts at one IP, and others at other. Matching there is done one the ServerName and ServerAlias lines.


Top
   
 Post subject:
PostPosted: Sat Feb 13, 2010 11:26 am 
Offline
Senior Newbie

Joined: Mon Feb 08, 2010 5:09 pm
Posts: 17
Creating a ServerAlias doesn't do enough. All it does is tell Apache to recognize the new domain/sub-domain. In order for people to actually be able to find it, you still have to add it to DNS.


Top
   
 Post subject:
PostPosted: Mon Feb 15, 2010 11:16 am 
Offline
Senior Newbie

Joined: Fri Feb 12, 2010 2:14 pm
Posts: 6
I had already done that though. I tried it two ways: creating a new domain zone for my subdomain through Linode's manager, and when that didn't work added a new A record for the subdomain, pointing to the IP address, through the DNS zone for the main domain.

The IP address that I listed above was simply to regard that my subdomain seemed to be pointing to the correct IP address.


Top
   
 Post subject:
PostPosted: Mon Feb 15, 2010 12:34 pm 
Offline
Senior Member

Joined: Fri Sep 12, 2008 3:17 am
Posts: 166
Website: http://independentchaos.com
a2ensite sub.domain.com && /etc/init.d/apache2 restart

_________________
If it ain't broke, you didn't tweak it enough. If it is broke, use more duct tape.
http://independentchaos.com


Top
   
 Post subject:
PostPosted: Mon Feb 15, 2010 12:53 pm 
Offline
Senior Newbie

Joined: Fri Feb 12, 2010 2:14 pm
Posts: 6
freedom_is_chaos... already did that. No joy. I'm stumped. I've double checked all of my spellings in my files, but it just doesn't want to show up.


Top
   
 Post subject:
PostPosted: Mon Feb 15, 2010 7:13 pm 
Offline
Senior Newbie

Joined: Mon Feb 08, 2010 5:09 pm
Posts: 17
Code:
kmw@charliebrown:~$ dig www.sub.itsbetterintheoven.com

; <<>> DiG 9.4.3-P4 <<>> www.sub.itsbetterintheoven.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52181
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;www.sub.itsbetterintheoven.com.        IN      A

;; AUTHORITY SECTION:
itsbetterintheoven.com. 86378   IN      SOA     ns1.linode.com. kenneth.tdpowerskills.com. 2010021171 14400 14400 1209600 86400

;; Query time: 1 msec
;; SERVER: 74.207.241.5#53(74.207.241.5)
;; WHEN: Mon Feb 15 17:10:40 2010
;; MSG SIZE  rcvd: 117


Note that there's no "ANSWER SECTION"; this is because www.sub.itsbetterintheoven.com does not actually exist in DNS. Are you sure you've got it configured correctly?

Now, sub.itsbetterintheoven.com does work, as does www.itsbetterintheoven. Are sure that www.sub.itsbetterintheoven.com is what you actually wanted?


Top
   
 Post subject:
PostPosted: Mon Feb 22, 2010 11:58 am 
Offline
Newbie

Joined: Mon Feb 22, 2010 11:56 am
Posts: 2
Not to hijack this thread, but I'm also having a similar issue with subdomain. Set A record in DNS, set VirtualHost, linked sites-available to sites-enabled, restarted Apache, etc.

To the OP: was this ever resolved?

EDIT: Ok, I got mine fixed. I realized I was supposed to be using a "CNAME" record instead of an "A" record. D'oh! Maybe this will help out.


Top
   
 Post subject: Same issue
PostPosted: Wed Feb 24, 2010 12:40 pm 
Offline
Newbie

Joined: Wed Feb 24, 2010 12:31 pm
Posts: 2
I'm having the same issue and I've followed the same steps as the OP and bdl. I followed this guide http://davidpodley.com/2010/02/11/setti ... nd-apache/ which suggests setting an A record for the subdomain. But, bdl, you say that you did it with a cname? What exactly did you use for your cname?

I tried setting a cname with a host name of "radiant" aliased to "bobby-marko.com" and that didn't work so I tried aliasing "radiant" to "radiant.bobby-marko.com" and that didn't work either. My original attempts were with the A record host name set to "radiant" and the IP address set to my Linode IP.

What am I doing wrong?

Here's my main domain virtual host:
Code:
<VirtualHost 74.207.233.205:80>
     ServerAdmin xxxx@xxxx.com
     ServerName bobby-marko.com
     ServerAlias www.bobby-marko.com
     DocumentRoot /srv/www/bobby-marko.com/public_html/
     ErrorLog /srv/www/bobby-marko.com/logs/error.log
     CustomLog /srv/www/bobby-marko.com/logs/access.log combined
</VirtualHost>

and my sub domain:
Code:
<VirtualHost 74.207.233.205:80>
    ServerName radiant.bobby-marko.com
    ServerAlias *.radiant.bobby-marko.com
    DocumentRoot /srv/www/radiant.bobby-marko.com/public/
    <Directory /srv/www/radiant.bobby-marko.com/public>
        Allow from all
        Options -MultiViews
    </Directory>
</VirtualHost>


Sorry if I'm making some huge mistake somewhere, I'm new to all of this. I also tried disabling the default site virtual domain file and I saw no change so I enabled it again.

Thanks

-Bobby


Last edited by bobbymarko on Fri Sep 17, 2010 10:11 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Wed Feb 24, 2010 12:49 pm 
Offline
Senior Member

Joined: Sat May 03, 2008 4:01 pm
Posts: 569
Website: http://www.mattnordhoff.com/
It does not matter to HTTP whether you use CNAME or A/AAAA records, as long as they lead to the correct destination in the end.

Regarding your actual issues, I don't know Apache, and I've got no idea. :D


Top
   
 Post subject: it's working now
PostPosted: Thu Feb 25, 2010 9:59 am 
Offline
Newbie

Joined: Wed Feb 24, 2010 12:31 pm
Posts: 2
The subdomain started working this morning. I think it just took a while for the dns to propagate.


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


Who is online

Users browsing this forum: No registered users and 1 guest


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