nixCraft Linux / UNIX / Shell Scripting Forum

nixCraft

Linux / UNIX Tech Support Forum

Smartest way to handle domains (vhost)

This is a discussion on Smartest way to handle domains (vhost) within the Web servers forums, part of the Mastering Servers category; First of all, GREAT site! Packed with useful information I'm currently setting up my first web server, using lighttpd. I'm ...


Register free or login to your account to remove all advertisements.

Go Back   nixCraft Linux / UNIX / Shell Scripting Forum > Mastering Servers > Web servers

Linux answers from nixCraft.


Web servers Discussion on Apache, Nginx and Lighttpd HTTP/web server and configuration issues.

Reply

 

Thread Tools Display Modes
  #1 (permalink)  
Old 15th March 2007, 03:24 PM
Junior Member
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oscar
Default Smartest way to handle domains (vhost)

First of all, GREAT site! Packed with useful information

I'm currently setting up my first web server, using lighttpd. I'm using "simple-vhost.conf" to handle domains, which looks like this (pretty standard):

Code:
server.modules += ( "mod_simple_vhost" )
simple-vhost.server-root         = "/var/www/"
simple-vhost.document-root       = "pages"
simple-vhost.default-host        = "blah.se"
$HTTP["host"] =~ "^www\.(.*)" { url.redirect = ( "^/(.*)" => "http://%1/$1" ) }
Would mod_evhost be better suited so that it would be easier to handle subdomains? Also, using this method, is it possible to have seperate log files, or I will have to write manual rules for every domain in that case?
Reply With Quote
  #2 (permalink)  
Old 15th March 2007, 03:53 PM
Junior Member
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oscar
Default

Aah, this seems to work pretty nice for domain/subdomain handling using evhost, but there's still the part with the log files.. Any ideas?

Code:
$HTTP["host"] =~ "^(www\.)?[^.]+\.[^.]+$" {
  evhost.path-pattern = "/home/%0/www/"
}

$HTTP["host"] !~ "^(www\.)?[^.]+\.[^.]+$" {
  evhost.path-pattern = "/home/%0/subdomains/%3/"
}
Reply With Quote
  #3 (permalink)  
Old 16th March 2007, 12:58 AM
rockdalinux's Avatar
Is that all you got?
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 840
Thanks: 21
Thanked 44 Times in 38 Posts
Rep Power: 13
rockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to behold
Default

Have you created /var/www/logs/ directory? See if you get logs there

Personally I am using something as follows (simple and easy to follow)

Code:
$HTTP["host"] == "domain1.com" {
  server.document-root = "/var/www/domain1.com"
  server.errorlog = "/var/log/lighttpd/domain1.com/error.log"
  accesslog.filename = "/var/log/lighttpd/domain1.com/access.log"
}

$HTTP["host"] == "domain2.com" {
  server.document-root = "/var/www/domain2.com"
  server.errorlog = "/var/log/lighttpd/domain2.com/error.log"
  accesslog.filename = "/var/log/lighttpd/domain2.com/access.log"
}
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #4 (permalink)  
Old 16th March 2007, 01:02 AM
Junior Member
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oscar
Default

Yeah, I'm getting logs, but for all sites. Your solution doesn't automatically handle new domains, that's what I'm trying to achieve. Doesn't seem like Lighttpd handles this yet, there's a feature request in trac to extend support in mod_evhost.
Reply With Quote
  #5 (permalink)  
Old 16th March 2007, 01:14 AM
rockdalinux's Avatar
Is that all you got?
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 840
Thanks: 21
Thanked 44 Times in 38 Posts
Rep Power: 13
rockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to beholdrockdalinux is a splendid one to behold
Default

Hello,

Yup I’m understanding your problem. Have u tried something say like (i don't think so it will work but just try out..)
Code:
server.errorlog = "/var/log/lighttpd/%0/error.log" 
accesslog.filename = "/var/log/lighttpd/%0/error.log"
Try out and lemme know
__________________
Rocky Jr.
What's wrong? I hope I am not making you uncomfortable...

Never send a boy to do a mans job.
Reply With Quote
  #6 (permalink)  
Old 16th March 2007, 01:34 AM
Junior Member
 
Join Date: Mar 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
oscar
Default

%0 is fillied by mod_evhost, so that won't work.
Reply With Quote
  #7 (permalink)  
Old 16th March 2007, 02:21 AM
nixcraft's Avatar
Never say die
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash, Perl, Python
Posts: 3,294
Thanks: 13
Thanked 411 Times in 304 Posts
Rep Power: 10
nixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond reputenixcraft has a reputation beyond repute
Default

I recommend reading article - Flexible vhost lighty config which utilize some scripts ruby and shell to create configuration along with lighttpd vars.

http://blog.ardes.com/articles/2006/...-lighty-config
__________________
Vivek Gite
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Do you run a Linux? Let's face it, you need help!
Cricket & IPL News Blog
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
running multiple privilegded domains namitha XEN 0 5th December 2007 02:58 PM
HOW TO HANDLE LOG FILES??? ishu Linux software 2 10th August 2006 05:40 AM
Apache multiple IP based domains and one certificate tom All about FreeBSD/OpenBSD/NetBSD 1 26th June 2006 07:23 PM


All times are GMT +5.5. The time now is 08:25 AM.


Powered by vBulletin® Version 3.8.6 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40