LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-15-2011, 09:39 AM   #1
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
Lighttpd variable scope


I'm learning lighttpd from a book, and it seems like I am dealing with a variable scoping issue, which doesn't quite makes sense to me. My default lighttpd.conf for gentoo defines:

Code:
var.basedir  = "/var/www/localhost"
This variable is, of course, used several ways later on. I want to change it to this:

Code:
var.basedir  = "/var/www/localhost
$HTTP["host"] == "other.domain.com" {
  var.basedir  = "/var/www/other-domain-com"
}
But it doesn't work. basedir seems to stay with the default value ("/var/www/localhost") regardless of the hostname I use. It is as if the second var.basedir assignment is being restricted to the scope of the brackets. But if I get rid of all my variables and just use server.document-root directly it works fine:

Code:
server.document-root = "/var/www/localhost/htdocs"
$HTTP["host"] == "other.domain.com" {
  server.document-root  = "/var/www/other-domain-com/htdocs"
}
Why would the server.document-root assignment not be restricted in scope while the var.basedir assignment is? Do I need to declare a variable global somehow?

Code:
# lighttpd -v
lighttpd/1.4.28 (ssl) - a light and fast webserver
Build-Date: Mar 12 2011 14:31:26
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] What is the difference between scope,linkage and life of a variable in C language ? dazzlinggopi Programming 5 03-07-2011 12:57 AM
Variable scope in KSH v5.2.14 99/07/13.2 UltramaticOrange Programming 4 08-20-2008 10:41 AM
How to reference a variable outside it's block scope in C daYz Programming 8 10-03-2007 02:48 AM
Variable scope Ephracis Programming 5 07-28-2006 01:22 PM
Variable available scope problem ArthurHuang Programming 1 05-22-2006 12:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration