天天看點

openssl源碼安裝後,編譯nginx-1.9.7或者openresty找不到OpenSSL的解決辦法

問題:nginx編譯找不到openssl

現象:源碼安裝openssl的目錄是/usr/local/ssl/

就算把/usr/local/ssl/lib 添加到 /etc/ld.so.conf内,并且ldconfig -v,發現nginx編譯時依然報找不到openssl的錯誤,如下

#./configure --with-http_ssl_modul

--------------------------------------------------------------

checking for OpenSSL library ... not found

checking for OpenSSL library in /usr/local/ ... not found

checking for OpenSSL library in /usr/pkg/ ... not found

checking for OpenSSL library in /opt/local/ ... not found

./configure: error: SSL modules require the OpenSSL library.

You can either do not enable the modules, or install the OpenSSL library

into the system, or build the OpenSSL library statically from the source

with nginx by using --with-openssl=<path> option.

-------------------------------------------------------------------

其實錯誤原因已經提示,就是沒有找到openssl庫檔案。

上面紅色字型的部分就是問題的原因所在,nginx會去紅色字型的幾個目錄下找openssl庫,而預設安裝的路徑是/usr/local/ssl

解決辦法:

把/usr/local/ssl/lib/目錄下的檔案拷貝一份到以上紅色路徑的lib目錄下即可,如cp /usr/local/ssl/lib/* /usr/local/lib/

之後再編譯nginx或者openresty就正常了。

附:

或者可以使用./configure --with-openssl=your_openssl_source_dir編譯。

繼續閱讀