nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

lighttpd domain and subdomain settings

This is a discussion on lighttpd domain and subdomain settings within the Web servers forums, part of the Mastering Servers category; kindly help me shorten my domain and subdomain setting. I want the www.domain.com and domain.com work same with www.subdomain.domain.com and ...


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 06-03-2007, 11:20 AM
Junior Member
User
 
Join Date: Mar 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
muks
Default lighttpd domain and subdomain settings

kindly help me shorten my domain and subdomain setting. I want the www.domain.com and domain.com work same with www.subdomain.domain.com and subdomain.domain.com

I currently have the following

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

$HTTP["host"] =~ "mydomain.info" {
server.document-root = "/home/mydomain/www"
server.errorlog = "/var/log/lighttpd/mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/mydomain.info/access.log"
}

$HTTP["host"] =~ "forums.mydomain.info" {
server.document-root = "/home/mydomain/subdomains/forums"
server.errorlog = "/var/log/lighttpd/forums.mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/forums.mydomain.info/access.log"
}

$HTTP["host"] =~ "www.forums.mydomain.info" {
server.document-root = "/home/mydomain/subdomains/forums"
server.errorlog = "/var/log/lighttpd/forums.mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/forums.mydomain.info/access.log"
}
Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 06-03-2007, 12:28 PM
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 244 Times in 183 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

Can you explain what do mean by shorten domain names; Make sure you replace =~ with == as you are not using wild cards regex i.e.

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

$HTTP["host"] == "mydomain.info" {
server.document-root = "/home/mydomain/www"
server.errorlog = "/var/log/lighttpd/mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/mydomain.info/access.log"
}

$HTTP["host"] == "forums.mydomain.info" {
server.document-root = "/home/mydomain/subdomains/forums"
server.errorlog = "/var/log/lighttpd/forums.mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/forums.mydomain.info/access.log"
}

$HTTP["host"] == "www.forums.mydomain.info" {
server.document-root = "/home/mydomain/subdomains/forums"
server.errorlog = "/var/log/lighttpd/forums.mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/forums.mydomain.info/access.log"
}
Let me know if you need any further help...
__________________
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
  #3 (permalink)  
Old 06-03-2007, 01:49 PM
Junior Member
User
 
Join Date: Mar 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
muks
Default

I wanna use wild cards so both www.domain.com and domain.com will go to

server.document-root = "/home/mydomain/www"


www.subdomain.domain.com and subdomain.domain.com will go to

/home/mydomain/subdomains/forums

so instead of having four "blocks" of codes, I'll only have two.

hope you could help me. I'm a big fan of your tutorials at cyberciti.biz that's why I was able to install lighttpd

thanks again
Reply With Quote
  #4 (permalink)  
Old 07-03-2007, 08:25 PM
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 244 Times in 183 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

You can try as follows:

Code:
$HTTP["host"] =~ "(^|\.)mydomain\.info$" {
server.document-root = "/home/mydomain/www"
server.errorlog = "/var/log/lighttpd/mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/mydomain.info/access.log"
}


$HTTP["host"] =~ "(^|\.)forums\.mydomain\.info$" {
server.document-root = "/home/mydomain/subdomains/forums"
server.errorlog = "/var/log/lighttpd/forums.mydomain.info/error.log"
accesslog.filename = "/var/log/lighttpd/forums.mydomain.info/access.log"
}
Let me know if you have any further issues...
__________________
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
  #5 (permalink)  
Old 08-03-2007, 06:39 PM
Junior Member
User
 
Join Date: Mar 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
muks
Default

thank you very much

bless you heart
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
awk - Removing domain name entires nvbhole Shell scripting 0 18-12-2007 11:14 AM
wi-fi connection and Domain login on windows surmandal Computer Networking and Internet/broadband 2 03-08-2007 06:51 PM
Howto remove the iptables settings on Linux sweta Getting started tutorials 0 27-07-2007 06:52 AM
Masquerade domain sendmail how to chiku Mail Servers 2 10-07-2007 08:20 AM
Help, samba 3.0.23 join ads domain warren Linux software 1 09-01-2007 03:41 PM


All times are GMT +5.5. The time now is 05:31 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