Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Jan 15, 2009 7:27 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
I have several domains working flawlessly with Apache. Today I tried adding a subdomain to one of them and that caused the problem.

In /etc/apache2/sites-available/ I have "domain.com" which works fine. I then duplicated it and renamed to "sub.domain.com" and ln -s'd it to sites-enabled.

When I tried to start Apache it failed. The subdomain is already added in /etc/hosts as "sub.domain.com". What might be causing this, any ideas?

"domain.com" in sites-available:
Code:
<VirtualHost *>
ServerAdmin admin@domain.com
ServerName domain.com
ServerAlias www.domain.com

DocumentRoot /var/www/vhosts/domain.com/htdocs

#<Directory /var/www/vhosts/domain.com>
AddHandler fcgid-script .php
FCGIWrapper /usr/lib/cgi-bin/php5 .php
#</Directory>

LogLevel warn
ErrorLog /var/www/vhosts/domain.com/log/error.log
CustomLog /var/www/vhosts/domain.com/log/access.log combined

</VirtualHost>


... and "sub.domain.com" file:
Code:
<VirtualHost *>
ServerAdmin admin@domain.com
ServerName sub.domain.com

DocumentRoot /var/www/vhosts/domain.com/subdomains/sub/htdocs

#<Directory /var/www/vhosts/domain.com/subdomains/sub>
#AddHandler fcgid-script .php
#FCGIWrapper /usr/lib/cgi-bin/php5 .php
#</Directory>

LogLevel warn
ErrorLog /var/www/vhosts/domain.com/subdomains/sub/log/error.log
CustomLog /var/www/vhosts/domain.com/subdomains/sub/log/access.log combined

</VirtualHost>


Last edited by dcelasun on Thu Jan 15, 2009 8:31 am, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Thu Jan 15, 2009 7:43 am 
Offline
Senior Newbie

Joined: Wed Dec 10, 2008 10:35 am
Posts: 14
The most common cause I've had for Apache not starting up is that the log file directories don't exist. Does the /var/www/vhosts/domain.com/subdomains/sub/log/ directory exist?

Other than that, the configuration looks fine to me.


Top
   
 Post subject:
PostPosted: Thu Jan 15, 2009 8:07 am 
Offline
Senior Member
User avatar

Joined: Tue Jan 04, 2005 7:32 am
Posts: 277
Website: http://www.betadome.com/
Location: Ă…lesund, Norway
Skype: neonnero
Twitter: neonnero
You'll also need to enable the new site you created.

As of Apache 2.2, I believe it ships with the command a2ensite. Run that command to enable the site, and it should get you going.

In simple terms, all it does is creating a symlink for the site from .../sites-available/ to .../sites-enabled/.


Top
   
 Post subject:
PostPosted: Thu Jan 15, 2009 8:22 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
Sophira, thanks that solved it!

NeonNero, as I've mentioned in my previous post, it's already enabled.

Now that this is done, I've added the subdomain as an A record in Linode DNS Manager. Should I wait for the TTL to expire? Because right now, sub.domain.com doesn't resolve.


Top
   
 Post subject:
PostPosted: Thu Jan 15, 2009 8:31 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
Update: Waiting for the TTL solved it, it now resolves fine. Thanks for the help guys.


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