How To Install CakePHP Via Lighttpd

由于lighttpd不能使用.htaccess中的规则,所以需要将cakephp目录下的.htaccess中的apache重写规则改成lighttpd格式。
配置如下

1
2
3
4
5
6
7
8
$HTTP["host"] =~ "^(www\.)?example.com" {
  server.document-root = "/home/www/example.com/app/webroot/"
  url.rewrite = (
    "/(.*)\.(.*)" => "$0",    #或者针对具体的文件类型(如/robots.txt): "^/(.*)\.(ico|txt)$" => "$0",
    "(css|files|img|js|stats)/(.*)" => "/$1/$2",
    "^([^\?]*)(\?(.+))?$" => "/index.php?url=$1&$3"
  )
}

开发环境的配置

1
2
3
4
5
6
7
8
9
10
11
$HTTP["host"] =~ "^(www\.)?example.com" {
  server.document-root = "/home/www/example.com/"
    url.rewrite-once = (
      "/project1/(.*)\.(.*)" => "$0",
      "/project1/(css|files|img|js|stats)/(.*)$" => "/project1/webroot/$1/$2",
      "^/project1/([^?]*)(\?(.+))?$" => "/project1/index.php?url=$1&$3"
      "/project2/(.*)\.(.*)" => "$0",
      "/project2/(css|files|img|js|stats)/(.*)" => "/project2/webroot/$1/$2",
      "^/project2/([^.]+)$" => "/project2/index.php?url=$1"
    )
}

這樣一來,所安裝的CakePHP的根目录就变成 了http://localhost/project1/ 。

[reference]

Monitor Your Web Site 24/7 - Receive email and SMS alerts anytime your web site goes down.

Related Posts

Leave a Reply

Monitor Your Web Site 24/7 - Receive email and SMS alerts anytime your web site goes down.

About Me

About Me
Record Technical Articles at Gooss.org.

Entries (RSS) and Comments (RSS). Valid XHTML and CSS and XFN.

© Copyright 2009 山海经. All rights reserved.

Social Bookmarks

Copyright © Designed by: Free WP Templates
Food Charts |  About Breast Milk |  Organic Food