如何在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

相关推荐

  • php-fpm常见错误及解决办法整理

    1,request_terminate_timeout引起的资源问题[v_tips]request_terminate_timeout的值如果设置为0或者过长的时间,可能会引起file_get_contents的资源问题。[/v_tips]如果file_get_contents请求的远程资源如果反应过慢,file_get_contents就会一直卡在那里不会…

    服务器运维 2018年8月16日
    2.9K00
  • (centos)linux如何查看和修改系统时间

    在linux中一般会使用date命令来查看当前系统时间,使用date -s命令来修改系统时间。 如何查看当前系统时间? date命令是用来显示系统时间的,可以按照指定格式来显示日期,如果只键入date则以默认格式显示当前系统时间。【视频教程推荐:linux教程】 例: [root@localhost ~]# date Fri Mar 1 10:36:45 P…

    2019年3月13日
    6.9K00
  • Linux中如何配置ftp服务器教程分享

    如果您有服务器咨询问题、购买问题、可以联系我们客服 7271895 690624 商祺云-阿里代理、景安代理、西部代理 1. 先用rpm -qa| grep vsftpd命令检查是否已经安装,如果ftp没有安装,使用yum -y install vsftpd 安装,(ubuntu 下使用apt-get install vsftpd) 2. service v…

    服务器运维 2019年1月17日
    2.9K00
  • 阿里云服务器创建快照备份云盘数据

    当您进行回滚云盘、修改关键系统文件、更换操作系统等重要操作之前,建议提前为云盘(系统盘或数据盘)创建快照做好数据备份,如果操作过程中导致了未预期的问题或数据丢失,您可以通过快照来恢复数据,保证业务连续性。本文介绍如何为单块云盘手动创建快照。 前提条件 已开通快照。具体操作,请参见开通快照。 云盘必须处于使用中或待挂载状态。不同状态下的注意事项如下: 如果云盘…

    2024年9月27日
    1.9K00
  • linux/centos下使用kill命令的使用教程方法

    kill命令 kill命令用来删除执行中的程序或工作。kill可将指定的信息送至程序。预设的信息为SIGTERM(15),可将指定程序终止。若仍无法终止该程序,可使用SIGKILL(9)信息尝试强制删除程序。程序或工作的编号可利用ps指令或job指令查看。 语法 kill(选择)(参数) 选项-a:当处理当前进程时,不限制命令名和进程号的对应关系;-l &l…

    2019年4月13日
    4.8K00

发表回复

登录后才能评论
联系我们

联系我们

18838889666

在线咨询: QQ交谈

邮件:xinyun@88.com

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

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