如何在Lighttpd Server中配置SSL的教程分享

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

如何在Lighttpd Server中配置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 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请求证书

创建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.conf

Syntax OK

如果发现所有语法都正常,让我们重新启动服务。

# service lighttpd restart

 

主题测试文章,只做测试使用。发布者:云大使,转转请注明出处:https://www.xp8.net/server/3652.html

(0)
打赏 微信扫一扫 微信扫一扫
分享如何使用Yum在CentOS和RHEL上安装Lighttpd Web服务器教程
上一篇 2019年5月7日 下午9:55
linux/centos中chmod命令怎么用?(详解)
下一篇 2019年5月7日 下午9:55

相关推荐

  • 学派吧-Linux中ecs-centosl2tp-vpn配置案例的图文详解-linux教程

    本文示例通过 l2tp vpn 从用户本地网络连接云服务器 ECS。 注:本文只作为相关配置的指引,阿里云不对相关配置结果或参数的问题负责。 原理和优点 与 PPTP 不同,Windows 所支持的 L2TP 协议并非利用 MPPE 对 PPP 帧进行加密。L2TP 依靠 Internet 协议安全性(IPSec)技术提供加密服务。L2TP 与 IPSec …

    服务器运维 2018年12月12日
    4.0K00
  • 如何处理Ping ECS实例的IP地址间歇性丢包-linux教程

    本篇文章给大家带来的内容是关于如何处理Ping ECS实例的IP地址间歇性丢包,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。 Ping ECS实例的IP地址间歇性丢包 问题描述 Ping ECS实例的IP地址间歇性丢包,ECS实例的网络一直处于不稳定状态 。 问题原因 系统中病毒。 解决方案 Ping外部存在丢包,但是延迟不大,排查不是带宽…

    服务器运维 2018年11月21日
    2.9K00
  • Linux cut命令的使用方法教程分享

    Linux cut命令用于根据字段提取文件内容。文本文件没有像数据库那样的行/列,有时我们只需要单列数据。根据分隔符剪切已识别的列(例如:冒号’:’,分号’;’,逗号’,’等)。 对于下面示例,我们采用/etc/passwd文件。所有行都以下面的格式存储,冒号(:)按如下方式分隔。我们使…

    2019年3月23日
    3.8K00
  • centos硬盘挂载报错mount: /dev/sdd1 already mounted or /data3 busy解决方法

    在挂载硬盘分区的时候,会出现mount: /dev/sdd1 already mounted or /data3 busy 或者是在执行格式化分区的时候也会出现 /dev/hdb1 is apparently in use by the system; will not make a filesystem here! 解决方法:[root@localhost…

    服务器运维 2019年3月10日
    13.5K00
  • bt宝塔专业版切换免费版降级恢复

    前言 这几天看到群里很多朋友反馈。购买了一个月专业版,想恢复到免费版,不知道如何处理。今天小编把教程整理下发布出来。 操作 切换至免费版: wget -O update.sh http://download.bt.cn/install/update.sh && bash update.sh free 切换至专业版: wget -O update.sh htt…

    服务器运维 2018年9月21日
    6.1K00

发表回复

登录后才能评论
联系我们

联系我们

18838889666

在线咨询: QQ交谈

邮件:xinyun@88.com

工作时间:周一至周五,9:30-18:30,节假日休息

添加微信
添加微信
分享本页
返回顶部