nixCraft Linux 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 ...


Go Back   nixCraft Linux Forum > Mastering Servers > Web servers

Linux answers from nixCraft.


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

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 15-03-2007, 03:24 PM
Junior Member
User
 
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 15-03-2007, 03:53 PM
Junior Member
User
 
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 16-03-2007, 12:58 AM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
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 16-03-2007, 01:02 AM
Junior Member
User
 
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 16-03-2007, 01:14 AM
rockdalinux's Avatar
Is that all you got?
User
 
Join Date: May 2005
Location: Planet Vegeta
OS: Redhat
Posts: 708
Thanks: 15
Thanked 19 Times in 18 Posts
Rep Power: 10
rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light rockdalinux is a glorious beacon of light
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 16-03-2007, 01:34 AM
Junior Member
User
 
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 16-03-2007, 02:21 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
OS: RHEL
Scripting language: Bash and Python
Posts: 2,710
Thanks: 11
Thanked 245 Times in 184 Posts
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft 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
Linux Evangelist
Be proud RHEL user, and let the world know about your enterprise choices! Join RedHat user group.
Always use CODE tags for posting system output and commands!
Do you run a Linux? Let's face it, you need help
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 05-12-2007 02:58 PM
HOW TO HANDLE LOG FILES??? ishu Linux software 2 10-08-2006 05:40 AM
Apache multiple IP based domains and one certificate tom All about FreeBSD/OpenBSD/NetBSD 1 26-06-2006 07:23 PM


All times are GMT +5.5. The time now is 02:14 PM.


Powered by vBulletin® Version 3.8.5 - 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