LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 09-19-2007, 02:05 AM   #1
scottley
LQ Newbie
 
Registered: Oct 2006
Distribution: Debian (server) FC6 (Laptop)
Posts: 6

Rep: Reputation: 0
debian with apache2 configuration for many VirtualHosts


Hello all. I just got finished bangin my head against Apache documentation, forum posts, and my monitor and here is what I've come up with (and confirmed as working)
Debian by default uses a2ensite/a2dissite to link Virtual Host files (you create) in the /etc/apache2/sites-available to /etc/apache2/sites-enabled. This is fine if you have one site or even two (and are really careful). But if you, like me, host many sites off the same IP address, then you will find the following information very helpful. By the way, if I am wrong, PLEASE tell me.
at the end of /etc/apache2/apache2.conf there is an Include /etc/apache2/sites-enabled directive. Comment this out and replace it with Include /etc/apache2/vhosts.conf
now, with your favorite editor create a file /etc/apache2/vhosts.conf.
In this file, the first line will be NamedVirtualHost <Some IP you have> where <Some IP you have> is an actual interface's IP address (if you are NATing, use your internal address).
the following lines should follow the normal VirtualHost Directives like:
Code:
NameVirtualHost 192.168.254.4
#################### Start SomeSite.com Vhost #####################

<VirtualHost 192.168.254.4>
    DocumentRoot /var/www/SomeSite
    ServerName SomeSite.com
    ServerAlias www.SomeSite.com
    ErrorLog /var/log/apache/SomeSite.com-error.log
    CustomLog /var/log/apache/SomeSite.com-access.log combined
    Options FollowSymLinks MultiViews
</VirtualHost>

#################### End SomeSite.com Vhost ########################

#################### Start SomeOtherSite.com Vhost #####################

<VirtualHost 192.168.254.4>
    DocumentRoot /var/www/SomeOtherSite
    ServerName SomeOtherSite.com
    ServerAlias www.SomeOtherSite.com
    ErrorLog /var/log/apache/SomeOtherSite.com-error.log
    CustomLog /var/log/apache/SomeOtherSite.com-access.log combined
    Options FollowSymLinks MultiViews
</VirtualHost>

#################### End SomeOtherSite.com Vhost ########################
The ErrorLog and CustomLog directives make mgmt easier and you will also add any other directives (Like SSL stuff) in the vhosts.conf

I hope this helps... please feel free to comment and complain.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best apache2 configuration to provide independent services cbonar Linux - Server 12 09-30-2007 06:01 AM
LXer: My Application of the Day: Kochizz for Apache2 Configuration LXer Syndicated Linux News 0 08-30-2007 01:10 AM
apache2 error - namevirtualhost *:0 has no virtualhosts? tiger.woods Ubuntu 2 04-09-2007 11:26 AM
Correct configuration for Apache2 and logrotate ricur Linux - Software 4 11-18-2004 01:22 PM
apache2 configuration e1000 Linux - Networking 1 01-28-2004 12:23 AM


All times are GMT -5. The time now is 09:30 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration