0

I'm trying to add subdomains to my home server.

svn.domain.com trac.domain.com

Due to dynamic IP I use dyndns service, on top of that I have domain.com hosted somewhere else. I created CNAME for subdomains on remote host to point to my user.dyndns.org domain.

So now when I visit either of subdomains: trac or svn, I see "It works!" message.

This done, I created two virtual host files under /etc/apache2/sites-enabled

file1: svn.domain.com and file2: trac.domain.com

contents:

<VirtualHost *:80>

  ServerName trac.domain.com

   DocumentRoot = /var/www/trac/repos

   <Directory /var/www/trac/repos>
    Order allow,deny
    allow from all
   </Directory>

</VirtualHost>

And

<VirtualHost *:80>

  ServerName svn.domain.com

   DocumentRoot = /var/svn/repos

   <Directory /var/svn/repos>
    Order allow,deny
    allow from all
   </Directory>

</VirtualHost>

But I get error: ERROR: Site trac.domain.com does not exist!

what am I doing wrong?

2

The config files need to be under /etc/apache2/sites-available. Then, when you do a2ensite, it will symlink those files to /etc/apache2/sites-enabled. You shouldn't need to touch sites-available manually.

1
  • there was also '=' after documentroot :) thx. – user25389 May 11 '12 at 22:42
0

You need to modify this lines in /etc/apache2/apache2.conf

Original /etc/apache2/apache2.conf :

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

New /etc/apache2/apache2.conf :

# Include generic snippets of statements
IncludeOptional conf-enabled/*

# Include the virtual host configurations:
IncludeOptional sites-enabled/*

Otherwise, you need to use the .conf extension for you vhost config file name

yes, the debian IncludeOptional is * by defaut, but for ubuntu, it's *.conf ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy