前言:
本文的主要宗旨是使用cygwin在windows下编译tengine, 同时使用tongsuo, 使tengine支持国密SSL. 本文的编译环境为win10专业版. 详细步骤如下.
1, 安装cygwin
https://cygwin.com/setup-x86_64.exe
安装步骤比较简单, 主要步骤如下:
下一页在选择站点的时候可以填写清华源地址, 如下:
https://mirrors.tuna.tsinghua.edu.cn/cygwin/
选择软件下载, 后面是我下载的版本, 各位自行选择即可.
gcc-g++ 11.4.0-1
perl 5.36.3-1
make 4.4.1-2
libcrypt-devel 4.4.20-1
automake autoconf libtool等等, 为了防止出错, 也可以一并下载
验证下安装是否成功, 其他三个各自验证, libcrypt可以用man crypt确认是否有man文档.
2, 下载文件和依赖
下载tongsuo, 我用的是8.3版本
https://github.com/Tongsuo-Project/Tongsuo/archive/refs/heads/8.3-stable.zip
下载pcre, 我用的是8.45版本
https://sourceforge.net/projects/pcre/
下载zlib, 我用的是1.3.1版本
https://zlib.net/zlib-1.3.1.tar.gz
下载tengine, 我用的是3.1.0版本
https://github.com/alibaba/tengine/archive/refs/heads/tengine-3.1.0.zip
把这4个文件放在同一个目录下, 并解压
3, 编译tongsuo
打开cygwin终端, 进入tongsuo目录
./Configure --prefix=/usr/local/tsssl gcc enable-ntls no-asm
make -j4 && make install
4, 编译tengine
从cygwin终端进入tengine目录
./configure --with-cc=gcc \--prefix=/usr/local/tengine \--conf-path=conf/nginx.conf \--pid-path=logs/nginx.pid \--http-log-path=logs/access.log \--error-log-path=logs/error.log \--sbin-path=nginx.exe \--add-module=modules/ngx_tongsuo_ntls \--with-openssl="/usr/local/tsssl" \--with-pcre="../pcre-8.45" \--with-zlib="../zlib-1.3.1" \--with-http_ssl_module \--with-stream \--with-stream_ssl_module \--with-stream_sni \--with-ld-opt="-lcrypt"
make -j12 && make install
编译成功.
结尾:
本文主要讲述了使用cygwin在windows下编译tengine, 如果编译遇到了问题, 请查一下gcc或者perl等等依赖未下载, 或者依赖的路径对不对, 或者复制configure命令的时候有编码问题. 也可以一起沟通讨论.