How to point subdomain to different directory ?
I've tried to search and read through the forums here, but I can't seem to find an answer for what I'm trying to do.
I don't think it is that complicated, just seems that I am missing something.
What I want to do, is have a subdomain point to a different directory.
For example, I want to set it up like this:
dev.mydomain.com --> points to --> /var/www/mydomain_dev
I've tried following the guide in the linode docs section the best I could, but I'm not a networking expert so it seems that I am missing something.
I'm not concerned about mail or anything like that, just the web addresses resolving to their respective directories.
the main domain, www.mydomain,com, is directing to the correct place. The subdomain is what I am having problems with.
Currently what I have done is this (per the linode docs section):
- Created files in the "sites-available" for each website, and put the following into the files:
/etc/apache2/sites-available/
ServerAdmin
ServerName
commented this out as unsure if need here
ServerAlias mydomain.com
Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/mydomain_live
Log file locations
LogLevel warn
ErrorLog /var/www/mydomainlive/log/error.log
CustomLog /var/www/mydomainlive/log/access.log combined
/etc/apache2/sites-available/dev.mydomain.com
ServerAdmin
ServerName dev.mydomain.com
commented this out as unsure if need here
ServerAlias mydomain.com
Index file and Document Root (where the public files are located)
DirectoryIndex index.php
DocumentRoot /var/www/mydomain_dev
Log file locations
LogLevel warn
ErrorLog /var/www/mydomaindev/log/error.log
CustomLog /var/www/mydomaindev/log/access.log combined
I then navigated to each doc root for each site, and made a symlink:
(I'm assuming I was supposed to do this from the directory which will be each sites root)
- Navigate to /var/www/mydomain_live
a2ensite
- Navigate to /var/www/mydomain_dev
a2ensite dev.mydomain.com
And then restarted Apache, etc.
In the linode dns manager, I originally had just created the mydomain.com, with the default records etc.
I then added an A/AAAA record for dev.mydomain.com
So my "zone file" looks like this:
@ IN SOA ns1.linode.com. my.email.com. 2012092803 14400 14400 1209600 86400
@ NS ns1.linode.com.
@ NS ns2.linode.com.
@ NS ns3.linode.com.
@ NS ns4.linode.com.
@ NS ns5.linode.com.
@ MX 10 mail.mydomain.com.
@ A 123.456.789.000
dev A 123.456.789.000
mail A 123.456.789.000
www A 123.456.789.000
At this point I really don't know what is missing, like I said I imagine it's something simple but I have no clue.
If anyone out there would be able to point my in the right direction, I would be very grateful.
This is an ubuntu lamp stack, just the typical setup that is created using the LAMP stack scripts, on a linode 512, if that makes a difference.
Thanks in advance for any replies.