Stunnel-为不支持https(ssl)的web服务器提供https(ssl)服务

Stunnel介绍

1.跨平台软件
2.依赖OpenSSL或SSLeay以实现TLS或SSL协议
3.为无法提供TLS或SSL服务的WEB服务器提供TLS或SSL服务,如thttpd不能提供TLS或SSL服务

下面是Stunnel为thttpd提供SSL服务的方法。

如何使用Stunnel

环境

OS: Ubuntu16.04
WebServer: thttpd

安装

下载:

下载stunnel-5.56.tar.gz
地址 https://www.stunnel.org/downloads.html

解压后编译安装:

./configure
make && make install

生成证书

cd /usr/local/etc/stunnel/
sudo openssl req -new -x509 -days 3650 -nodes -out stunnel.pem -keyout stunnel.pem

配置文件

vi /usr/local/etc/stunnel/stunnel.conf

内容:

[https]
accept = 8080 #8080是stunnel服务端口号,即浏览器访问时的端口号
connect = 8888 #8888是thttpd服务端口号
cert = /usr/local/etc/stunnel/stunnel.pem #之前生成的证书

如下图(分号;是注释):


stunnelconf.png