所有使用ssl运行的站点都在默认端口443上使用了https协议。ssl通过加密服务器和客户端之间的数据来提供安全的数据通信。

在我们之前的文章中,我们已经介绍了如何在CentOS/RHEL系统中安装LightTPD和创建虚拟主机。本文将继续介绍在LightTPD服务器中配置SSL。对于本篇文章中的示例,我们使用的是自签名证书。
如果要在apache/httpd中查找configure ssl,那么可能需要阅读本篇文章。
步骤1:创建证书签名请求(CSR)
对于创建SSL证书,第一个要求是创建私钥和CSR。CSR是一个文件,其中包含有关域的所有详细信息,包括公钥。首先创建一个目录,在其中创建CSR和密钥。
# mkdir /etc/lighttpd/ssl/# cd /etc/lighttpd/ssl/
现在使用以下命令创建CSR和密钥文件。根据域更改文件名example.com.key和example.com.csr。此命令将要求输入有关您的域的信息。了解有关创建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 incorporatedinto 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 blankFor some fields there will be a default value,If you enter '.', the field will be left blank.-----Country Name (2 letter code) [XX]:INState or Province Name (full name) []:DelhiLocality Name (eg, city) [Default City]:DelhiOrganization Name (eg, company) [Default Company Ltd]:TecAdmin Inc.Organizational Unit Name (eg, section) []:webCommon Name (eg, your name or your server's hostname) []:example.comEmail Address []:user@example.comPlease enter the following 'extra' attributesto be sent with your certificate requestA challenge password []: [Leave Blank]An optional company name []: [Leave Blank]
步骤2:从CA请求证书
创建CSR后,从任意证书提供商(如geotrust、comodo、digicert或godaddy等)请求一个SSL证书。
或创建供内部使用的自签名证书
# openssl x509 -req -days 365 -inexample.com.csr-signkeyexample.com.key-outexample.com.crt
将在名为example.com.crt的当前目录中获取创建的证书文件。现在通过将密钥文件和证书组合在一个文件中来创建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.confSyntax OK
如果发现所有语法都正常,让我们重新启动服务。
# service lighttpd restart
【相关推荐:Linux视频教程】
以上就是如何在Lighttpd Server中配置SSL的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/174296.html
微信扫一扫
支付宝扫一扫