如何在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)
打赏 微信扫一扫 微信扫一扫
云大使的头像云大使
上一篇 2019年5月7日 下午9:55
下一篇 2019年5月7日 下午9:55

相关推荐

  • centos安装wdcp教程及问题解决方案

    wdcp是什么 wdCP是WDlinux Control Panel的简称,是一套通过WEB控制和管理服务器的Linux服务器管理系统以及虚拟主机管理系统,旨在易于使用Linux系统做为我们的网站服务器系统,以及平时对Linux服务器的常用管理操作,均可在wdCP的后台里操作完成.使用wdCP,通过WEB方式就可以查看服务器情况,资源利用率,系统负载,内存使…

    2018年9月14日
    2.9K00
  • Linux下rootkit后门检测工具chkrootkit安装使用教程

    今天给大家打来一篇关于linux下rootkit后门检测工具教程 说明: 操作系统:CentOS 一、安装编译工具包 yum install gcc gcc-c++ make yum install glibc-static 二、安装chkrootkit cd /usr/local/src/ wget ftp://ftp.pangeia.com.br/pub…

    服务器运维 2018年10月17日
    4.4K00
  • Linux vsftpd连接报错:500 OOPS: vsftpd的解决办法详解-学派吧-

    问题现象 云服务器 ECS Linux 系统用 vsftpd 搭建的 FTP 服务,客户端连接时提示报错 “500 OOPS: vsftpd: refusing to run with writable root inside chroot()” 处理办法 1. 在服务器上修改Vsftpd的配置文件vsftpd.conf vim /etc/vsftpd/vs…

    2019年1月1日
    3.3K00
  • 从阿里云域名解析到DNSPod,如何实现 DNS 平滑迁移?

    腾讯云解析 DNSPod 向全网域名提供快速、安全的智能解析服务,拥有精准调度、安全防护、容灾切换等能力,为您全面提升业务可用性、稳定性。 解析记录迁移 导出解析记录 进入后单击导入/导出,并选择导出记录 导出文件类型选择zone,并单击立即导出。 导出完成后重命名文件,添加.zone后缀,如下两图所示: 导入解析记录 添加需要迁移的域名,以dnstest.…

    2026年1月12日
    19400
  • nginx配置location教程及rewrite规则教程

    nginx配置location教程及rewrite规则教程 location正则写法 实际使用建议 Rewrite规则 flag标志位 if指令与全局变量 if判断指令 全局变量 常用正则 rewrite实例 location正则写法 一个示例: location = / { # 精确匹配 / ,主机名后面不能带任何字符串 [ configuration A…

    服务器运维 2018年10月11日
    1.7K00

发表回复

登录后才能评论
联系我们

联系我们

18838889666

在线咨询: QQ交谈

邮件:xinyun@88.com

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

添加微信
添加微信
分享本页
返回顶部
---------官方优惠叠加渠道折扣:通过我们购买腾讯云/阿里云,价格更低,服务更优。更有专业配置指导与服务。微信同步:18838889666----