Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Setting Up Subdomains
PostPosted: Fri Jan 23, 2009 7:56 pm 
Offline
Senior Newbie

Joined: Thu Jan 22, 2009 7:20 pm
Posts: 11
Website: http://wpthoughts.com/
Location: Sydney
I've managed to get virtualhosts working for two of my domains so far. Now I'm wanting to create a subdomain for one of the domains.

I thought that following the same procedure to create a new virtualhost but using the subdomain as the ServerName would work.

But I couldn't get it to work, am I missing something here?


Top
   
 Post subject:
PostPosted: Fri Jan 23, 2009 8:31 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Did you restart Apache after making the changes?

Do you have a DNS record for your subdomain pointing to your Linode's IP address?

Does the ServerName directive for your subdomain conflict with anything else you've set up? (Is it listed as a ServerAlias in another virtualhost? Is it covered by a wildcard ServerName in another virtualhost? Is it identical to your Apache server's default ServerName?)


Top
   
 Post subject:
PostPosted: Sat Jan 24, 2009 2:33 am 
Offline
Senior Newbie

Joined: Thu Jan 22, 2009 7:20 pm
Posts: 11
Website: http://wpthoughts.com/
Location: Sydney
Here are the config files that I have setup.

This is the main domain that is working. I have another domain using the same codes/layout
Code:
# Notes

<VirtualHost *:80>

# Admin Details
ServerAdmin webmaster@wpthoughts.com
ServerName  wpthoughts.com
ServerAlias www.wpthoughts.com

# Index and Document Root
DirectoryIndex index.php index.html
DocumentRoot   /var/www/wpthoughts.com

# Log Files
LogLevel warn
ErrorLog  /var/www/wpthoughts.com/logs/error.log
CustomLog /var/www/wpthoughts.com/logs/access.log combined

</VirtualHost>


And this is the file for the subdomain that isn't working.
Code:
# Notes
<VirtualHost *:80>

# Admin Details
ServerAdmin webmaster@wpthoughts.com
ServerName  themes.wpthoughts.com
# ServerAlias www.wpthoughts.com

# Index and Document Root
DirectoryIndex index.php index.html
DocumentRoot   /var/www/themes.wpthoughts.com

# Log Files
LogLevel warn
ErrorLog  /var/www/themes.wpthoughts.com/logs/error.log
CustomLog /var/www/themes.wpthoughts.com/logs/access.log combined

</VirtualHost>


Here is the DNS render file
Code:
$TTL 86400
@   IN   SOA   ns1.linode.com. andrewjbarnett.gmail.com. (
               2009012406
               7200
               7200
               1209600
               86400
            )
@      NS   ns1.linode.com.
@      NS   ns2.linode.com.
@      NS   ns3.linode.com.
@      NS   ns4.linode.com.
@         MX   10   ASPMX.L.GOOGLE.COM.
www         A   72.14.181.193
@         A   72.14.181.193
themes         CNAME   wpthoughts.com.


I did 'a2ensite' for the subdomain, and restarted Apache2 as well without success.


Top
   
 Post subject:
PostPosted: Sat Jan 24, 2009 10:08 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
The "default" site might be interfering with your subdomains. Try running
Code:
# a2dissite default
# /etc/init.d/apache2 reload

Then try your subdomain again.


Top
   
 Post subject:
PostPosted: Sat Jan 24, 2009 3:17 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
dcelasun wrote:
The "default" site might be interfering with your subdomains. Try running
Code:
# a2dissite default
# /etc/init.d/apache2 reload

Then try your subdomain again.


Depending on your distribution, you might get undesirable behavior if you disable the default site. Just make sure that nothing in the default site interferes with any other virtual host.

One common problem involves the hostname. If you have manually set your hostname in /etc/hostname and/or /etc/apache2/apache2.conf, you must make sure that it is different from all the other domains/subdomains being hosted.

How exactly is it "not working"? What are the symptoms?


Top
   
 Post subject:
PostPosted: Sat Jan 24, 2009 4:32 pm 
Offline
Senior Newbie

Joined: Thu Jan 22, 2009 7:20 pm
Posts: 11
Website: http://wpthoughts.com/
Location: Sydney
The default site is disabled, so all the main domains are working, its just when it comes to the subdomain.

I changed the A record to a CNAME record, and OpenDNS has the correct IP address against the domain now.

However PHP isn't being parsed anymore. I navigate to the domain, and the my browser downloads the php file rather then parsing it.


Top
   
 Post subject:
PostPosted: Sat Jan 24, 2009 5:22 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
sphinx wrote:
However PHP isn't being parsed anymore. I navigate to the domain, and the my browser downloads the php file rather then parsing it.


Now that's a bigger problem!

What's your distro? If it's Debian or Ubuntu, apt-get install libapache2-mod-php5 automatically sets everything up (assuming that you're using Apache2 with PHP5)

But please, reenable the default site and try to tinker with only those settings in the default file that you suspect is causing a problem. Depending on your distro and version, the default file might contain important configuration directives (e.g. NameVirtualHost).

And again, it's not helpful to just say "it doesn't work". What's happening? Does your subdomain show another site? Does it throw a 404? Or is it the PHP problem you described above?


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


Who is online

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