1007
技術社區[雲棲]
下載配置lighttpd
- 創建開發子目錄 dev/,下載 Lighttpd 源代碼並解壓到其下,最新 Lighttpd 穩定版代碼為 lighttpd-1.4.19:
$ mkdir dev $ cd dev $ wget https://www.lighttpd.net/download/lighttpd-1.4.19.tar.bz2 $ tar xjf lighttpd-1.4.19.tar.bz2 $ cd lighttpd-1.4.19
- 安裝必要的開發包:
$ ports/bzip2-devel
- 編譯安裝(如果沒有設置sudo,需要su為root用戶):
$ ./configure $ make $ sudo make install
安裝完成後 lighttpd 就被安裝到了/usr/local/sbin/lighttpd
這個位置上。 - 新建 lighttpd 配置文件
/usr/local/etc/lighttpd.conf
(路徑隨意,lighttpd 啟動時指定正確的配置文件路徑即可),內容如下:server.document-root = "/home/share/htdocs/lighttpd" server.port = 7500 server.username= "nobody" server.groupname = "nobody" server.modules = ( "mod_access", "mod_accesslog" ) # performance settings server.max-worker = 8 server.max-fds = 2048 server.max-connections = 1024 # no keep-alive permitted server.max-keep-alive-requests=0 # specify possible index files for root directory index-file.names = ( "index.html", "index.htm" ) # mimetype mapping mimetype.assign = ( ".html" => "text/html", ".htm" => "text/html", # default mime type "" => "application/octet-stream", ) # error log file path server.errorlog = "/tmp/error" # access log file path accesslog.filename = "/tmp/access" # WebDAV options webdav.activate = "enable" webdav.is-readonly = "disable"
- 啟動 lighttpd:
$ sudo /usr/local/sbin/lighttpd -f /usr/local/etc/lighttpd.conf
最後更新:2017-04-02 00:06:30