0

I'm configurintg virtual hosting on lighttpd. For some reason only 1 virtual hosting work and the other doesn't. This is the configuration:

#this doesn't work (just a html file)
$HTTP["host"] =~ "^www\.website\.com$" {
  server.document-root = "/var/www/astudio/sites/websiteTemp"
}

#this works (Drupal installation)
$HTTP["host"] =~ "beta\.website\.com" {
  server.document-root = "/var/www/astudio/sites/website"
  server.errorlog = "/var/log/lighttpd/danydiop/error.log"
  accesslog.filename = "/var/log/lighttpd/danydiop/access.log"
  include_shell "./drupal-lua-conf.sh danydiop"

 url.access-deny += ( "~", ".inc", ".engine", ".install", ".info",
       ".module", ".sh", "sql", ".theme",
       ".tpl.php", ".xtmpl", "Entries",
       "Repository", "Root" )


  # "Fix" for Drupal SA-2006-006, requires lighttpd 1.4.13 or above
  # Only serve .php files of the drupal base directory
  $HTTP["url"] =~ "^/.*/.*\.php$" {
      fastcgi.server = ()
      url.access-deny = ("")
  }

  magnet.attract-physical-path-to = ("/etc/lighttpd/drupal-lua-scripts/p-.lua")

}

what am I missing ? When it doesn't work, I just get the page "It Works!" instead of the folder content

aneuryzm
  • 1,614
  • 5
  • 25
  • 40

1 Answers1

0

Hay there..

Try this..

$HTTP["host"] =~ "^(www\.website\.com)$" {
  server.document-root = "/var/www/astudio/sites/websiteTemp"
}

my guess is you missed the carat and brackets ( i think its called a carat )

Sorry.. i didnt see that either.. you could always avoid that with not using the regex expressions like this

$HTTP["host"] =~ "www.website.com" {

cheers

Arenstar
  • 3,592
  • 2
  • 24
  • 34
  • @Arenstar uhm still nothing. I've updated the question with your correction – aneuryzm Nov 07 '10 at 19:56
  • Try that again.. :D – Arenstar Nov 07 '10 at 20:14
  • @Arenstar Indeed.. just using www.website.com worked, thanks. One last question, is there a way to redirect multiple subdomains to the same path without writing everything multiple times ? (i.e. I want www2.website.com to display the same content as well – aneuryzm Nov 07 '10 at 23:51
  • @Patrick you will need to use the regex expressions to do this.. here is examples that can be used $HTTP["host"] =~ "^(blog\.|www\.|)site\.com$" { # the rest of your site configuration here } $HTTP["host"] =~ "^(blog\.site\.com|www\.site\.com)$" { # the rest of your site configuration here } However you will need lighttpd to support regex expressions (pcre).. Did you compile or install a package??? – Arenstar Nov 07 '10 at 23:56
  • @Arenstar uhm ok. I've actually installed lighttpd with aptitude on Ubuntu 10. Do I really need to recompile it ? Isn't possible to download that module and enable it ? – aneuryzm Nov 08 '10 at 00:13
  • Its possible on Ubuntu that you use the lighty-enable-mod to enable pcre.. ( im not exactly sure ) but you cant use regex stuff withtout it.. Perhaps lighttpd -V shows what is compiled in.. I imagine that aptitude installs pcre or pcre-devel with lighttpd.. You shouldnt need to compile it at all – Arenstar Nov 08 '10 at 00:29
  • @Arenstar: if you use "=~" it's still a regular expression (or a regex, but not a regex expression). It just doesn't look like one at first glance. Oh, and it's "caret". – Jürgen A. Erhard Jan 18 '11 at 13:48