Project

General

Profile

Actions

Bug #1714

closed

Variable weirdness

Added by Anonymous almost 16 years ago. Updated over 15 years ago.

Status:
Invalid
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

I run a site that shares code base with another site (the code has smarts inside to display the correct site) however a few things (like access log) i want to be different depending on what site is being loaded. So in my lighttpd.conf i have something like


$HTTP["host"] =~ "^(www\.site1\.net|site1\.net|www\.site2\.net|site2\.net)$" {

        # custom details for vhost
        server.document-root    = "/home/site/public_html/" 

        $HTTP["host"] =~ "^(www\.site1\.net|site1\.net)$" {
                accesslog.filename      = "/var/log/lighttpd/site1-access.log" 
                expire.url = ( "/site1_images/" => "access 24 hours" , "/site1_css/" => "access 24 hours" , "/js/" => "access 24 hours" )
                global {
                        var.domain = "site1" 
                }
        }

        $HTTP["host"] =~ "^(www\.site2\.net|site2\.net)$" {
                accesslog.filename      = "/var/log/lighttpd/site2-access.log" 
                expire.url = ( "/site2_images/" => "access 24 hours" , "/site2_css/" => "access 24 hours" , "/js/" => "access 24 hours" )
                global {
                        var.domain = "site2" 
                }
        }
        # <2 pages of rewrites/misc settings cut>
}

and later i want to use the variable 'domain' to do some rewrites. However when trying to start the server it says i can't define var.domain twice.. if i change the above so var.domain += "site2" in my redirects it shows domain has been set to "site1site2" when in fact it should only be "site2"..

(if i don't use global around the var's url.rewrite doesn't seem to see the variable)

-- michael.dodwell

Actions #1

Updated by stbuehler almost 16 years ago

  • Status changed from New to Fixed
  • Resolution set to invalid

The lighttpd config is not a script, and you can't use "variables" like you do in real scripts.

You could put the rewrite part in a separate file and include it in your vhosts after setting the var (without global {...}).

Actions #2

Updated by stbuehler over 15 years ago

  • Status changed from Fixed to Invalid
Actions

Also available in: Atom