星期二, 11月 08, 2005

 

再起程‧cygwin之旅 (lighttpd篇) その2


上一回只說了lighttpd的起動和PHP編譯等...
設定還沒說呢...這一次就說一下lighttpd設定和PHP優化吧!

先說一下lighttpd的設定...看看下面的例子:
# default document-root
# 預設的根目錄的位置
server.document-root = "/var/www/example.org/pages/"

# TCP port
# lighttpd所用的連接埠
server.port = 80

# selecting modules
# 要載入的模組, 建議只載入有需要的模組
# 可載入的模組有這些:
# mod_access mod_accesslog mod_auth mod_cgi mod_compress
# mod_evhost mod_expire mod_fastcgi mod_httptls mod_maps
# mod_proxy mod_redirect mod_rewrite mod_rrdtool mod_ssi
# mod_secdownload mod_simple_vhost mod_status mod_usertrack
#
# mod_rewrite 必須為第一個載入而mod_accesslog必須為最後一個載入
server.modules = ( "mod_access", "mod_cgi", "mod_alias", "mod_status", "mod_accesslog" )

# enable directory listings
# 顯示目錄中的檔案清單
server.dir-listing = "disable"

# where to send error-messages to
# 錯誤信息寫入至
server.errorlog            = "/var/www/logs/lighttpd.error.log"

# files to check for if .../ is requested
# 當xxx/被要求時所送出的檔案
server.indexfiles          = ( "index.php", "index.html", 
                                "index.htm", "default.htm" )

# mimetype mapping
# MIME類型, 沒有指定的均為"application/octet-stream"
mimetype.assign            = (  ".png"  => "image/png", 
                                ".jpg"  => "image/jpeg",
                                ".jpeg" => "image/jpeg",
                                ".gif"  => "image/gif",
                                ".html" => "text/html",
                                ".htm"  => "text/html",
                                ".pdf"  => "application/pdf",
                                ".swf"  => "application/x-shockwave-flash",
                                ".spl"  => "application/futuresplash",
                                ".txt"  => "text/plain",
                                ".tar.gz" =>   "application/x-tgz",
                                ".tgz"  => "application/x-tgz",
                                ".gz"   => "application/x-gzip",
    ".c"    => "text/plain",
    ".conf" => "text/plain",
           ".css"  => "text/css",
                                ".js"   => "text/javascript",
    ".asc" =>       "text/plain",
    ".dvi" =>       "application/x-dvi" ,
    ".ps" =>        "application/postscript" ,
    ".mpeg" =>      "video/mpeg" ,
    ".mpg" =>       "video/mpeg" ,
    ".avi" =>       "video/x-msvideo" ,
    ".mov" =>       "video/quicktime" ,
    ".qt"  =>       "video/quicktime" ,
    ".mp3" =>       "audio/mpeg" ,
    ".ogg" =>       "audio/x-wav" ,
    ".wav" =>       "audio/x-wav" ,
    ".pac" =>       "application/x-ns-proxy-autoconfig" ,
    ".sig" =>       "application/pgp-signature" ,
    ".torrent"  =>  "application/x-bittorrent" ,
    ".class" =>     "application/octet-stream" ,
    ".tar" =>       "application/x-tar" ,
    ".zip" =>       "application/zip" ,
    ".dtd" =>       "text/xml" ,
    ".xml" =>       "text/xml" ,
    ".xbm" =>       "image/x-xbitmap" ,
    ".xpm" =>       "image/x-xpixmap" ,
    ".xwd" =>       "image/x-xwindowdump" ,
    ".text" =>      "text/plain" ,
    ".m3u"  =>      "audio/x-mpegurl",
    ".wmv" =>       "video/x-ms-wmv",
 )

# accesslog module
# 存取記錄模組
accesslog.filename          = "/var/www/logs/access.log"

# CGI module
# CGI模組
# .pl/.cgi 由 /bin/perl 執行, .php 由 /usr/local/bin/php-cgi 執行, .sh為可執行檔
cgi.assign                  = ( ".pl"  => "/bin/perl",
                                ".cgi" => "/bin/perl",
                                ".php" => "/usr/local/bin/php-cgi",
                                ".sh" => ""
)

# Alias module
# 別名模組
# WWW 目錄 /mtrg/ 指到主機目錄 /var/www/mrtg/
alias.url = ( 
  "/mtrg/" => "/var/www/mrtg/", 
     )

# status module
# 狀態模組
status.status-url = "/server-status"

# Allow /mirror/* to list dir
# 條件式設定示範 - 容許 WWW 目錄 /mirror/ 列出檔案清單
# ↓當url的開首為 /mirror/ 時開放列出檔案清單功能 (正規表達式)
$HTTP["url"] =~ "^/mirror/" {
  server.dir-listing = "enable"
}

lighttpd的設定大致是這樣了...

說一下PHP優化吧...
在用PHP時...覺得好像很慢嗎?
可能是PHP沒調較好吧...
去看一下Performance Tuning PHP吧!
編譯時參數沒設好/php.ini中的設定/php.ini所在的位置/php腳本中的語法等都有關啊...
好好參詳一下吧

きょうはここまでです。それでは~

標籤:


Backlinks

建立連結

留言


發佈回應

發佈留言

留不了言?試試在這裡留吧。
回首頁