| Linode Forum https://forum.linode.com/ |
|
| How to point subdomain to different directory ? https://forum.linode.com/viewtopic.php?f=19&t=9417 |
Page 1 of 1 |
| Author: | johnnyquest [ Fri Sep 28, 2012 7:36 pm ] |
| Post subject: | How to point subdomain to different directory ? |
Hello everyone, 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: www.mydomain.com --> points to --> /var/www/mydomain_live 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/www.mydomain.com <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin my@email.com ServerName www.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_live # Log file locations LogLevel warn ErrorLog /var/www/mydomain_live/_log/error.log CustomLog /var/www/mydomain_live/_log/access.log combined </VirtualHost> /etc/apache2/sites-available/dev.mydomain.com <VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin my@email.com 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/mydomain_dev/_log/error.log CustomLog /var/www/mydomain_dev/_log/access.log combined </VirtualHost> 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 www.mydomain.com - 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. |
|
| Author: | johnnyquest [ Fri Sep 28, 2012 10:10 pm ] |
| Post subject: | Re: How to point subdomain to different directory ? |
Edit - Nevermind, there was a stray htacess file in one of the directories that was causing the problem, the above configuration works as it should. |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|