Lighttpd安裝及配置

來源:互聯網
上載者:User

Linux發行版本:Fedora 14 i686

Lighttpd源碼包:lighttpd-1.4.32.tar.gz

1、安裝Lighttpd依賴軟體。

      FIXME

2、解壓縮源碼包並安裝軟體

      # tar -zxf lighttpd-1.4.32.tar.gz

      # cd lighttpd-1.4.32

      # ./configure --prefix=/usr/local/lighttpd-1.4.32    註:--prefix指定安裝路徑,預設為[/usr/local]

      # make

      # make install

3、編寫設定檔

      # mkdir /etc/lighttpd

      # vim lighttpd.conf

      內容如下:

# 路徑:/etc/lighttpd/lighttpd.conf

########## 基本配置 ##########
# 載入模組
server.modules = ("mod_accesslog", "mod_fastcgi")
# 基本變數
var.server_root = "/var/www/lighttpd"
var.log_root    = "/var/log/lighttpd"
# 伺服器根路徑
server.document-root = server_root
# 伺服器監聽連接埠
server.port = 80
# 伺服器日誌路徑
server.errorlog = log_root + "/error.log"
accesslog.filename = log_root + "/access.log"
# 首頁檔案
index-file.names += (
    "index.html", "index.php"
)

########## 常用配置 ##########
# 運行使用者及使用者組,啟動使用者須有root許可權
server.username  = "lighttpd"
server.groupname = "lighttpd"

########## CGI配置 ##########
fastcgi.server = ( ".php" =>    # 檔案擴充。Lighttpd內部提供FastCGI載入均衡
                   ( "php-local" =>     # 可選。用於mod_status統計,指示處理該檔案擴充的幕後處理器
                     (
#                       "socket" => "/var/run/php-fastcgi-1.socket",    # FIXME 實現
                       "host" => "127.0.0.1",   # 指定socket或者host+port。
                       "port" => 9999,
                       "bin-path" => "/usr/bin/php-cgi",    # 如果本地FastCGI沒有運行,該路徑本地FastCGI將被啟動
                     )
                   ),
                )

FIXME

4、添加Lighttpd命令到PATH和sudo環境

      添加Lighttpd命令道PATH很簡單,不再贅述。

      使用visudo命令或者直接編輯/etc/sudoers,把Lighttpd的bin路徑加入到secure_path,如下所示:

Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/lib/lighttpd-1.4.32/sbin    註:secure_path是sudo的PATH環境

5、運行Lighttpd

      # lighttpd -f /etc/lighttpd/lighttpd.conf -m /usr/local/lighttpd-1.4.32/lib    註:-m指定模組路徑,預設為[/usr/local/lib]

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.