lighttpd配置多ip,多域名

lighttpd是个不错的http服务器,占用资源少,很多人的网站并没有太多访问量,像本人的,所以最好的选择就是轻量级的lighttpd.现学现写啊,主要是我发现我每次重装机器,都忘记原来的配置怎么写的,所以记在这儿嘿嘿嘿.

其实仔细看一下它的lighttpd.conf文件可以知道很多.好了不多说吧,上配置文件.

lighttpd的配置文件一般在/etc/lighttpd下

lighttpd.conf是主配置文件,我们只要动它就可以了

#server.bind                = “localhost”
改成
server.bind                = “localhost”

#这是第一个ip
$SERVER["socket"] == “111.111.111.111:80″ {
  $HTTP["host"] == “design.xxx.net” {
    server.name = “design.xxx.net”
    server.document-root = “/var/html/xxx.net/design”
#去掉下面三行就可以让这个站不能用php解释
    fastcgi.server = ( “.php” => ((
      “bin-path” => “/usr/bin/php4-cgi”,
      “socket” => “/tmp/php.socket”
    )))
  }
  $HTTP["host"] == “blog.xxx.net” {
    server.name = “blog.xxx.net”
    server.document-root = “/var/html/xxx.net/blog”
    fastcgi.server = ( “.php” => ((
      “bin-path” => “/usr/bin/php4-cgi”,
      “socket” => “/tmp/php.socket”
    )))
  }
  $HTTP["host"] == “www.xxx.net” {
    server.name = “www.xxx.net”
    server.document-root = “/var/html/xxx.net/www”
    url.redirect                = ( “^/blog($|/(.+))” => “http://blog.xxx.net/” )
#上面那行是url跳转,会正则表达式的研究一下吧,我还不太会用,记得要打redirect的mod喔
  }
}

#这是第二个ip
$SERVER["socket"] == “222.222.222.222:80″ {
  $HTTP["host"] == “www.bbb.com” {
    server.name = “www.bbb.com”
    server.document-root = “/var/html/bbb.com/www”
    fastcgi.server = ( “.php” => ((
      “bin-path” => “/usr/bin/php4-cgi”,
      “socket” => “/tmp/php.socket”
    )))
  }

  $HTTP["host"] == “www.ccc.com” {
    server.name = “www.ccc.com”
    server.document-root = “/var/html/ccc.com/www”
  }

}

Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word