• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Apache VHost organization

oversize

New Member

Thanks: 1
Messages: 19

#1
Hello,

i own a debian based server with 2 friends. Some like the Plesk interface to configure apache stuff. I do django development on that and mod_python was not configurable through plesk ... :p

I looked into httpd.conf, vhosts.conf (and what not), generated by Plesk ... what a mess! x(
The debian way of doing apache stuff did additionaly confuse me and i thought, damn configuring and running apache productively must be sooo hard!

My company needed some web-activities-upgrades, including getting off of those 5$ per month php/mysql accounts and just running them on a single (own) server.

Although, i was a little scared i decided to rent us a freebsd server.

And woah ... i am impressed!

My httpd.conf looks so clean now and just does the same stuff as the debian based install does including mod_python / mod_wsgi, awstats, a wiki, other webanalyzing tools as piwik and ...

Thank You FreeBSD !! ... enough of that private gibberish.

What i would like to know, how do you organize your VHosts?
I run 6 different Domains with different subdomains. I use mod_macro to have a little reuse of common settings.

But maybe there is some tool out there i never heard of and should give it a chance ?(not web based, as i like to keep the web footrpint simple)

... sometimes i'm dreaming of some ncurses based VHost configuration application. Like a Plesk for the console.

--
cheers
 

brd@

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 89
Messages: 297

#2
In my /usr/local/etc/apache22 directory I usually create a vhosts directory and create file a in there for each domain, ending with a '.conf'. Something like:
Code:
/usr/local/etc/apache22/vhosts/example.com.conf
 

dave

Well-Known Member

Thanks: 23
Messages: 400

#3
To clarify, then you can use an include statement in httpd.conf with a wildcard. Such as...

Code:
Include etc/apache22/vhosts/*.conf
 

rink@

New Member
Developer


Messages: 4

#4
Does anyone still know if Apache still scales badly if you have lots and lots of vhosts (I'm talking about >1000 here) ? It used to be so bad that you had to use mod_rewrite magic to get any form of decent performance out of it... note that this was in the 1.3 days, does anyone have more recent experiences with 2.2+ ?
 

devel

New Member

Thanks: 1
Messages: 5

#5
mod_macro seems to be very handy in terms of handling virtual hosts. Whole site can be 'common thing'. So once you built 'template' and further only one string is required in order to create new site. Or you can build predefined set of templates based on different policies (also determined by means of mod_macro).

rink@ said:
Does anyone still know if Apache still scales badly if you have lots and lots of vhosts (I'm talking about >1000 here) ? It used to be so bad that you had to use mod_rewrite magic to get any form of decent performance out of it...
Sounds interesting... Could you, please, tell more regarding solution based on mod_rewrite?
 

cajunman4life

Active Member

Thanks: 20
Messages: 119

#7
I too use a vhosts directory, and use the include directive in the vhost config file to include all *.conf files in there. Within the directory, I create a file with as <userid>.conf. As users can have multiple domains on my system, I found this to be the most sane way to keep track of who owns what (also helps with log file splitting, as apache will open a file descriptor for each log file it writes to, I have apache write everything to one log file, and then at 1am every morning I split the log file based on domain, and then deliver the domain logs to the account the domain belongs to (found by seeing which <userid>.conf file the domain is defined in)).

This particular setup works well, though at the moment I only have about 20 virtual domains hosted. It'll be interesting to see how this scales once I add hundreds.

Note: I'm running apache 2.2