Skip to content

使用自定义 OpenSSL 库编译 nginx #4

@AnthonyHMT

Description

@AnthonyHMT

编译安装 nginx 时,默认使用系统自带的 OpenSSL 库,但其一般很老,不支持如 SDPY 等新功能。--with-openssl 参数虽然可以指定 OpenSSL 路径,但只支持 OpenSSL 的源代码,不支持已编译好的 OpenSSL。每回更新 nginx 都要重新编译 OpenSSL 肯定很麻烦,于是经过一番搜索后,从 nginx forum 找到了解决方案。

修改 auto/lib/openssl/conf,将:

CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"

改为:

CORE_INCS="$CORE_INCS $OPENSSL/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"

这样,我们就可以在编译安装 nginx 时,手动指定已编译好的 OpenSSL 了,比如 --with-openssl=/usr/local/openssl。

原文参见:https://www.sinosky.org/compile-nginx-with-a-custom-openssl-library.html

使用类似方法,还可以使nginx使用已编译好的zlib、pcre等。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions