如何在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(centos)中查找文件创建时间教程

    文件创建时间存储在ext4文件系统的inode中。早期版本的ext文件系统不支持文件创建时间。debugfs stat输出中有一个crtime(创建时间)时间戳。最后,ext4支持创建时间,就像在ntfs窗口中btime一样。 可以按照以下说明查找文件创建时间。选个例子,我使用的是一个现择现有文件或创建新文件进行测试。对于这有的文件。 步骤1:查找inode…

    2019年3月13日
    5.7K00
  • 如何在Linux上编译和运行C和C++程序教程-学派吧

    C是一种用于开发系统软件的强大编程语言。本篇文章将介绍关于通过命令行在Linux系统中运行C和C ++程序。在本篇文章中,我们使用GCC(GNU Compiler Collection)的’gcc’和’g ++’命令来编译C / C ++程序。 gcc是GCC中的GNU C编译器。 g ++是GCC中的GNU …

    2019年3月13日
    2.8K00
  • debian9安装mariadb apache php7-Linux运维-学派吧

    有需要服务器方面的需求和咨询,可以联系博主 QQ 7271895 一、 apt install apache2 二、 apt install php (安装后测试phpinfo) <?php phpinfo(); ?> 三、 apt install mariadb-server 1、安装完 MariaDB 之后,运行 mysql_secure_i…

    服务器运维 2018年9月30日
    2.3K00
  • Linux解压gz文件的命令使用教程及详解

    今天小编给带来一篇linux解压方面的资料 Linux解压gz文件的命令有:gunzip命令、gzip命令、tar命令。下面本篇文章就来带大家了解一下 gz文件是一种压缩文件,以.gz或者.tar.gz(.tgz)为扩展名,在Linux、UNIX和OSX下常见,Linux和OSX都可以直接解压使用这种压缩文件。在Windows下常用压缩软件WinRAR打开g…

    2019年3月13日
    87.5K00
  • 学派吧-详解linux 删除换行符的方法-linux教程

    这篇文章主要介绍了linux 删除换行符的方法小结,需要的朋友可以参考下 今天需要删除文件里面的换行符,比如有一个文件a.txt: 1,2,34,5,61,2,34,5,61,2,34,5,61,2,34,5,61,2,34,5,6 1、使用vim删除换行符 vim输入命令:%s/\n//g 2、使用sed命令,例如 sed ':t;N;s/\n/…

    服务器运维 2019年1月1日
    2.1K00

发表回复

登录后才能评论
联系我们

联系我们

18838889666

在线咨询: QQ交谈

邮件:xinyun@88.com

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

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