[SOLVED] Apache refuses to start

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:

 <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:

 <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> 

4 Replies

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.

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/.

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.

Update: Waiting for the TTL solved it, it now resolves fine. Thanks for the help guys.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct