溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

在Lighttpd Server中配置SSL的方法

發(fā)布時間:2020-08-26 13:48:32 來源:億速云 閱讀:167 作者:小新 欄目:建站服務器

在Lighttpd Server中配置SSL的方法?這個問題可能是我們?nèi)粘W習或工作經(jīng)常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!

所有使用SSL運行的站點都在默認端口443上使用了https協(xié)議。SSL通過加密服務器和客戶端之間的數(shù)據(jù)來提供安全的數(shù)據(jù)通信。

在Lighttpd Server中配置SSL的方法

在我們之前的文章中,我們已經(jīng)介紹了如何在CentOS/RHEL系統(tǒng)中安裝LightTPD和創(chuàng)建虛擬主機。本文將繼續(xù)介紹在LightTPD服務器中配置SSL。對于本篇文章中的示例,我們使用的是自簽名證書。

如果要在apache/httpd中查找configure ssl,那么可能需要閱讀本篇文章。

步驟1:創(chuàng)建證書簽名請求(CSR)

對于創(chuàng)建SSL證書,第一個要求是創(chuàng)建私鑰和CSR。CSR是一個文件,其中包含有關域的所有詳細信息,包括公鑰。首先創(chuàng)建一個目錄,在其中創(chuàng)建CSR和密鑰。

# mkdir /etc/lighttpd/ssl/
# cd /etc/lighttpd/ssl/

現(xiàn)在使用以下命令創(chuàng)建CSR和密鑰文件。根據(jù)域更改文件名example.com.key和example.com.csr。此命令將要求輸入有關您的域的信息。了解有關創(chuàng)建CSR的更多信息。

# openssl req -new -newkey rsa:2048 -nodes -keyout example.com.key -out example.com.csr
Generating a 2048 bit RSA private key
....+++
...............+++
writing new private key to 'example.com.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:Delhi
Locality Name (eg, city) [Default City]:Delhi
Organization Name (eg, company) [Default Company Ltd]:TecAdmin Inc.
Organizational Unit Name (eg, section) []:web
Common Name (eg, your name or your server's hostname) []:example.com
Email Address []:user@example.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: [Leave Blank]
An optional company name []: [Leave Blank]

步驟2:從CA請求證書

創(chuàng)建CSR后,從任意證書提供商(如geotrust、comodo、digicert或godaddy等)請求一個SSL證書。

或創(chuàng)建供內(nèi)部使用的自簽名證書

# openssl x509 -req -days 365 -inexample.com.csr-signkeyexample.com.key-outexample.com.crt

將在名為example.com.crt的當前目錄中獲取創(chuàng)建的證書文件。現(xiàn)在通過將密鑰文件和證書組合在一個文件中來創(chuàng)建pem文件

# cat example.com.key  example.com.crt > example.com.pem

步驟3:使用SSL設置虛擬主機

編輯lighttpd配置文件/etc/lighttpd/lighttpd.conf并添加以下值。

$SERVER["socket"] == ":443" {
        ssl.engine = "enable"
        ssl.pemfile = "/etc/lighttpd/ssl/tecadmin.net.pem"
      # ssl.ca-file = "/etc/lighttpd/ssl/CA_issuing.crt"
        server.name = "site1.tecadmin.net"
        server.document-root = "/sites/vhosts/site1.tecadmin.net/public"
        server.errorlog = "/var/log/lighttpd/site1.tecadmin.net.error.log"
        accesslog.filename = "/var/log/lighttpd/site1.tecadmin.net.access.log"
}

步驟4:驗證配置并重新啟動lighttpd

啟動lighttpd服務之前,請驗證配置文件的語法。

# lighttpd -t -f /etc/lighttpd/lighttpd.conf

Syntax OK

如果發(fā)現(xiàn)所有語法都正常,讓我們重新啟動服務。

# service lighttpd restart

感謝各位的閱讀!看完上述內(nèi)容,你們對在Lighttpd Server中配置SSL的方法大概了解了嗎?希望文章內(nèi)容對大家有所幫助。如果想了解更多相關文章內(nèi)容,歡迎關注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI