Enable virtual hosting for more than 2 domains

Discussion in 'Programming' started by nura235, Sep 11, 2009.

  1. #1
    Well i am using Linux VPS with centos.

    and recently updated to lighttpd.

    i have 3 domains in /var/www/html named as

    www.domain1.com
    www.domain2.com
    www.domain3.com

    first www.domain1.com is a default domain and working fine.

    what to do to map all my domain to work exactly when pinging from the browser.

    Right now i have change the code in lighttpd.conf
    $HTTP["host"] =~ "(^|\.)domain1.com$" {
      server.document-root = "/var/www/html/www.domain1.com/"
    }
    
    $HTTP["host"] =~ "(^|\.)domain2.com$" {
       server.document-root = "/var/www/html/www.domain2.com/"
    }
    
    Code (markup):
     
    nura235, Sep 11, 2009 IP
  2. ohteddy

    ohteddy Member

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #2
    That config looks correct to me. What happens when you go to domain2.com, does it show an 200 or 404 response? Have you tried restarting lighty after you modified the config?
     
    ohteddy, Sep 13, 2009 IP