nixCraft Linux Forum

nixCraft

Linux 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

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-15-2007, 03:24 PM
Junior Member
 
Join Date: Mar 2007
Posts: 4
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
Sponsored Links
  #2 (permalink)  
Old 03-15-2007, 03:53 PM
Junior Member
 
Join Date: Mar 2007
Posts: 4
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 03-16-2007, 12:58 AM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 554
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
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.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #4 (permalink)  
Old 03-16-2007, 01:02 AM
Junior Member
 
Join Date: Mar 2007
Posts: 4
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 03-16-2007, 01:14 AM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 554
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
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.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #6 (permalink)  
Old 03-16-2007, 01:34 AM
Junior Member
 
Join Date: Mar 2007
Posts: 4
Rep Power: 0
oscar
Default

%0 is fillied by mod_evhost, so that won't work.
Reply With Quote
  #7 (permalink)  
Old 03-16-2007, 02:21 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Any distro with shell
Posts: 902
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 | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
Reply

Bookmarks


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 On

Similar Threads

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


All times are GMT +5.5. The time now is 12:15 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

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