ubuntu18.04LTS下解決Nginx新增openssl模組編譯時報錯問題
阿新 • • 發佈:2019-01-08
ubuntu18.04LTS下解決Nginx新增openssl模組編譯時報錯問題
報錯提示
make -f objs/Makefile make[1]: Entering directory '/home/zhang/share/nginx-1.14.0' make[1]: *** No rule to make target '/home/zhang/share/nginx-1.14.0/packages/include/openssl/ssl.h', needed by 'objs/src/core/nginx.o'. Stop. make[1]: Leaving directory '/home/zhang/share/nginx-1.14.0' Makefile:8: recipe for target 'build' failed make: *** [build] Error 2
解決方法
第一步安裝libssl-dev
sudo apt-get install libssl-dev
點選參考連結
第二步下載libssl-dev
開啟ubuntu包管理網址 https://packages.ubuntu.com/trusty/libssl-dev
下載http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.0.1f.orig.tar.gz 解壓檔案
mkdir /home/zhang/share/nginx-1.14.0/packages cd /home/zhang/share/nginx-1.14.0/packages/ wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.0.1f.orig.tar.gz tar -xf openssl_1.0.1f.orig.tar.gz
第三步修改編譯配置
開啟nginx原始檔下的/home/zhang/share/nginx-1.14.0/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/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/libcrypto.a"
最後一步編譯安裝
./configure --prefix=/home/zhang/share/nginx-1.14.0/local --with-openssl=/home/zhang/share/nginx-1.14.0/packages/openssl-1.0.1f --with-http_ssl_module
make && make install