You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Agnello George <ag...@gmail.com> on 2008/06/25 11:03:29 UTC

[users@httpd] seperate vhost files for each domain

Hi
I would just like to know if it would be a good good option to have
separate vhost fies for each domain, this would make editing the files
( through shell scripts much easier ). But my only concern here is
would Apache be overloaded by reading multiple vhost files
to illustrate i would like to have something like  this :

in my httpd.conf flile
# Virtual hosts
Include conf/extra/httpd_vhost/

then i the following dir ( /usr/local/apache2/conf/extra/httpd_vhost/
) i will have :

domain1_vhost.conf
domain2_vhsot.conf
domain3_vhost.conf ............
..............................
..............................

this would make editing of a particular file much easy  through shell
script instead do  having all the directives in one httpd_vhost.conf

Awaiting your reply


-- 

सादर
Agnello Dsouza
www.linux-vashi.blogspot.com

Re: [users@httpd] seperate vhost files for each domain

Posted by Scott Courtney <sc...@sinenomine.net>.
On Wed, 2008-06-25 at 11:26 +0200, Martin Barry wrote:
> Include /etc/apache2/sites-enabled/
> 
> which graps all files in that directory in alphabetical order.

I really like this configuration method, and have recently migrated my
non-Debian servers to use the same style even though it's not the
default for some Linux distros.

One caution is that if you're setting this up by hand, you'll want your
default vhost to have a prefix so that it's guaranteed to be first in
alphabetical order, so name it something like "000-default".

If you install the apache2 package under Debian, a sensible default
vhost config file is appropriately named during installation.

Scott

-- 
Scott Courtney <sc...@sinenomine.net>
Sine Nomine Associates


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] seperate vhost files for each domain

Posted by Martin Barry <ma...@supine.com>.
$quoted_author = "Agnello George" ;
> 
> I would just like to know if it would be a good good option to have
> separate vhost fies for each domain, this would make editing the files
> ( through shell scripts much easier ). But my only concern here is
> would Apache be overloaded by reading multiple vhost files

I'd imagine the configuration would be of similar size so Apache wouldn't
really care either way.

Debian (and it's derivatives) have a setup where you did split up
configurations into multiple files in:

/etc/apache2/sites-available/

and activated them by symlinking to them from

/etc/apache2/sites-enabled/

Apache includes them with

Include /etc/apache2/sites-enabled/

which graps all files in that directory in alphabetical order.

cheers
Marty

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: [Suspected Phishing Fraud] [Disarmed Scripts] Re: [users@httpd] seperate vhost files for each domain

Posted by Res <re...@ausics.net>.
On Thu, 26 Jun 2008, Agnello George wrote:

>The only  viable option would be storing , vhost directive in a DB ,  but 
>i really have  not found any one in the industry that has tried this 
>method. I

We used to a few years ago, but I had it changed because it caused us no 
end of problems.

>Also storing vhsot in separate conf file is OK for couple of hundred
>domains, but for a web hosting company having 1000 + domains on each 
>server i guess separate file cause problem

This is correct, which is why i wonde rif any of these people using the 
'debian way' of vhost per file have actually used it in REAL environments, 
and if so, have they tried it in one vhost.conf file and noticed the 
differences, ther 'deabian way' seems a good idea as you pointed out,  if 
and only if you have a few hosts but when you have thousands as most 
hosting companies/ISP's-with-shared-hosting do, it would be have a 
performance impact.

If I get bored one day I might try it out on our dev box and see if there 
is any factual noticable impact as I suspect there would be.

> in,  1) editing  the separate 
> files through scripts 2) graceful restart would also create a problem on 
> the server

1 : no it wouldnt matter, you just create the vhost file or delete it and 
restart apache

2 : agreed, have found that to be the case in and up to 2.2.8 have not 
tried it with 2.2.9

-- 
Cheers
Res
 	--- Usenet policy, and why I might ignore you ---
1/ GoogleGroups are UDP'd on my nntp server. If you use them, don't
    waste your time or energy replying to me.

2/ If only cleanfeed filtered out trolls as well as spam, usenet would be
    a nicer place.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] seperate vhost files for each domain

Posted by Norman Peelman <np...@cfl.rr.com>.
Agnello George wrote:
>
>
> On 6/26/08, Res <res@ausics.net <ma...@ausics.net>> wrote:
> > On Wed, 25 Jun 2008, John Hicks wrote:
> >
> > > Remember that Apache only reads its configuration once, when it is 
> started
> > up, so the additional processing is minimal.
> > >
> >
> > But what would be the impact, like reading one 20K httpd.conf and 
> one 300K
> > vhosts.conf file, or 2000 separate files, the latter seems like a lot of
> > extra work, sure it might be negligible for a hundred or so odd 
> hosts, but
> > what about when you have thousands, I'd think the additional I/O 
> would add
> > tremendously to stop/start/restart times at least.
> >
> > It is really trivial to write a perl script to add/delete vhost blocks.
> >
>  
> The only  viable option would be storing , vhost directive in a 
> DB ,  but i really have  not found any one in the industry that has 
> tried this method. I was able to find a workaround  for storing vhost 
> in DB (  
> http://develobert.blogspot.com/2007/12/database-storage-of-apache-virtual.html  
> ).
>  
>  But the thing with this every time a small change to the DB i have to 
> restart / graceful restart Apache.    
>  
  You have to restart when you make changes anyway...



> For Lighthttpd there is a MySQL-virtual-hosting module available .( 
> http://trac.lighttpd.net/trac/wiki/Docs#Optionsformod_mysql_vhost-Mysqlvirtualhostingmodule ) But 
> i cannot find any such module for Apache 2.2.8. <http://2.2.8.>  ... 
> and ideas here ??
>  
>  
> Also storing vhsot in separate conf file is OK for couple of hundred 
> domains, but for a web hosting company having 1000 + domains on each 
> server , i guess separate file cause problem  in,  1) editing  the 
> separate files through scripts 2) graceful restart would also create a 
> problem on the server 
>
>
> -- 
>
> सादर
> Agnello Dsouza
> www.linux-vashi.blogspot.com <http://www.linux-vashi.blogspot.com>
>  


-- 
Norman
Registered Linux user #461062


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] seperate vhost files for each domain

Posted by Agnello George <ag...@gmail.com>.
On 6/26/08, Res <re...@ausics.net> wrote:
> On Wed, 25 Jun 2008, John Hicks wrote:
>
> > Remember that Apache only reads its configuration once, when it is
started
> up, so the additional processing is minimal.
> >
>
> But what would be the impact, like reading one 20K httpd.conf and one 300K
> vhosts.conf file, or 2000 separate files, the latter seems like a lot of
> extra work, sure it might be negligible for a hundred or so odd hosts, but
> what about when you have thousands, I'd think the additional I/O would add
> tremendously to stop/start/restart times at least.
>
> It is really trivial to write a perl script to add/delete vhost blocks.
>

The only  viable option would be storing , vhost directive in a DB ,  but i
really have  not found any one in the industry that has tried this method. I
was able to find a workaround  for storing vhost in DB (
http://develobert.blogspot.com/2007/12/database-storage-of-apache-virtual.html
).
 But the thing with this every time a small change to the DB i have to
restart / graceful restart Apache.

For Lighthttpd there is a MySQL-virtual-hosting module available .(
http://trac.lighttpd.net/trac/wiki/Docs#Optionsformod_mysql_vhost-Mysqlvirtualhostingmodule
) But
i cannot find any such module for Apache 2.2.8.  ... and ideas here ??


Also storing vhsot in separate conf file is OK for couple of hundred
domains, but for a web hosting company having 1000 + domains on each server
, i guess separate file cause problem  in,  1) editing  the separate files
through scripts 2) graceful restart would also create a problem on the
server


-- 

सादर
Agnello Dsouza
www.linux-vashi.blogspot.com

Re: [users@httpd] seperate vhost files for each domain

Posted by Res <re...@ausics.net>.
On Wed, 25 Jun 2008, John Hicks wrote:

> Remember that Apache only reads its configuration once, when it is started 
> up, so the additional processing is minimal.

But what would be the impact, like reading one 20K httpd.conf and one 300K 
vhosts.conf file, or 2000 separate files, the latter seems like a lot of
extra work, sure it might be negligible for a hundred or so odd hosts, 
but what about when you have thousands, I'd think the additional I/O would 
add tremendously to stop/start/restart times at least.

It is really trivial to write a perl script to add/delete vhost blocks.


-- 
Cheers
Res
 	--- Usenet policy, and why I might ignore you ---
1/ GoogleGroups are UDP'd on my nntp server. If you use them, don't
    waste your time or energy replying to me.

2/ If only cleanfeed filtered out trolls as well as spam, usenet would be
    a nicer place.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] seperate vhost files for each domain

Posted by John Hicks <jo...@gulfbridge.net>.
Agnello George wrote:
> Hi
> I would just like to know if it would be a good good option to have
> separate vhost fies for each domain, this would make editing the files
> ( through shell scripts much easier ). But my only concern here is
> would Apache be overloaded by reading multiple vhost files
> to illustrate i would like to have something like  this :
>
> in my httpd.conf flile
> # Virtual hosts
> Include conf/extra/httpd_vhost/
>
> then i the following dir ( /usr/local/apache2/conf/extra/httpd_vhost/
> ) i will have :
>
> domain1_vhost.conf
> domain2_vhsot.conf
> domain3_vhost.conf ............
> ..............................
> ..............................
>
> this would make editing of a particular file much easy  through shell
> script instead do  having all the directives in one httpd_vhost.conf
>   

This should work just fine. The Ubuntu Linux distribution comes with the 
Apache configuration set up with multiple files in a similar manner.

Remember that Apache only reads its configuration once, when it is 
started up, so the additional processing is minimal.

- John Hicks