项目

常规

个人资料

操作

1 - 安装 Joomla

2 - 进入 Joomla 管理后台 -> 全局配置 -> 站点。启用 搜索引擎友好的 URL使用 Apache mod_rewrite

3 - 在 lighttpd 中添加此站点描述,其中更改 '''

$HTTP["host"]

server.document-root

为您的设置

示例

$HTTP["host"] =~ "(^|\.)site\.com$" {
server.document-root = "/usr/local/www/data/site.com" 
   url.rewrite-once = (
          "^images\*\.(jpg|jpeg|gif|png)" => "$0",
          "^/administrator.\*$" => "$0",
          "^/mambots.\*$" => "$0",
          "(/|\.htm|\.php|\.html|/[^.]\*)$" => "/index.php" 
     )
}

除了这种方法,您还可以使用 Lua 进行重写。创建一个新文件并添加

-- little helper function
function file_exists(path)
  local attr = lighty.stat(path)
  if (attr) then
      return true
  else
      return false
  end
end
function removePrefix(str, prefix)
  return str:sub(1,#prefix+1) == prefix.."/" and str:sub(#prefix+2)
end

-- prefix without the trailing slash
local prefix = ''

-- the magic ;)
if (not file_exists(lighty.env["physical.path"])) then
    -- file still missing. pass it to the fastcgi backend
    request_uri = removePrefix(lighty.env["uri.path"], prefix)
    if request_uri then
      lighty.env["uri.path"]          = prefix .. "/index.php" 
      local uriquery = lighty.env["uri.query"] or "" 
      lighty.env["uri.query"] = uriquery .. (uriquery ~= "" and "&" or "") .. "q=" .. request_uri
      lighty.env["physical.rel-path"] = lighty.env["uri.path"]
      lighty.env["request.orig-uri"]  = lighty.env["request.uri"]
      lighty.env["physical.path"]     = lighty.env["physical.doc-root"] .. lighty.env["physical.rel-path"]
    end
end
-- fallthrough will put it back into the lighty request loop
-- that means we get the 304 handling for free. ;)

然后,在您的 lighttpd.conf 中添加类似以下内容

$HTTP["url"] !~ "^/(xcache-admin|awstatsclasses|awstatsicons|awstatscss|awstats|cacti|webmail|phpmyadmin)(/|$)" {
index-file.names = ( "index.php" )
magnet.attract-physical-path-to = ( "/usr/local/etc/lighttpd/lua/domain.com/www.lua" )
}

Jormangeud超过 12 年 前更新 · 8 个修订