Jump to content

Recommended Posts

You need to use two seperate virtual hosts. eg;

 

NameVirtualHost *

<VirtualHost *>
  ServerName domain.com
  ServerAlias www.domain.com
  DocumentRoot /var/www/domain.com
  <Directory /var/www/domain.com>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    DirectoryIndex index.php
  </Directory>
  ErrorLog /var/log/apache2/domain.com-error.log
  LogLevel warn
  CustomLog /var/log/apache2/domain.com-access.log combined
</VirtualHost>

<VirtualHost *>
  ServerName test.domain.com
  DocumentRoot /var/www/test.domain.com
  <Directory /var/www/test.domain.com>
    Options FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    DirectoryIndex index.php
  </Directory>
  ErrorLog /var/log/apache2/test.domain.com-error.log
  LogLevel warn
  CustomLog /var/log/apache2/test.domain.com-access.log combined
</VirtualHost>

Hello all, I'm am new to LAMP server builds, so I will apologize for my newbishness upfront.

 

I *almost* understand about virtual host configurations. I have a development server running Debian Lenny, with several virtual hosts defined in the /etc/apache2/sites-enabled

I am accessing the sites through my network, using manual host files on the other computers. I see these sites fine.

 

However, I tried to recreate this setup on my Kubuntu Gutsy laptop, and have hit a patch of fog. (does not work the same)

 

My questions:

 

NameVirtualHosts * <- do I put that in my individuals /sites-available/domain1 files, in a separate vhosts file under /etc/apache2/conf.d, or in the httpd.conf file?

 

Do I declare the virtual hosts in the httpd.conf file or under the sites-available directory?

 

Thank you for your help,

Rockhopper

 

 

There are lots of different ways different distros setup there apache configs, I prefer (usually) to roll my own.

 

You only need to have the NameVirtualHosts * line once and it must be before any vhosts are defined, so with a Debian setup, I usually place this just prior to the...

 

Include /etc/apache2/sites-enabled/*

 

line within the apache.conf file. I'm not exactly sure how Kubuntu would be setup by default, but there usually all pretty similar. You just need to know the order in which each file is included and what there intended pupose is.

 

I have a few posts in my blog (http://thorpesystems.com) that may be of interest to you. I'm not sure how helpfull they will be but you might get some ideas.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.