Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 "./ 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

share|improve this question
up vote 0 down vote accepted

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"] =~ "" {


share|improve this answer
@Arenstar uhm still nothing. I've updated the question with your correction – Patrick Nov 7 '10 at 19:56
Try that again.. :D – Arenstar Nov 7 '10 at 20:14
@Arenstar Indeed.. just using 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 to display the same content as well – Patrick Nov 7 '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 7 '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 ? – Patrick Nov 8 '10 at 0:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.