安裝openresty時,執行 ./configure時一直報:./configure: error: SSL modules require the OpenSSL library.
./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沒安裝成功,再次yum install openssl,但是發現明明已經是有openssl存在的了。。。
看錯誤提示:
or build the OpenSSL library statically from the source with nginx by using --with-openssl=<path> option.
很開心,按上面的指示,應該是要指定openssl的位置,於是which openssl找到openssl的安裝位置, ./configure時增加參數,--with-openssl=/usr/local/bin/openssl,(這一步是錯誤的!!!)
./configure是通過了,但是,在執行gmake時就出現了新問題,
gmake[2]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 127 gmake[2]: Leaving directory `/root/openresty-1.11.2.2/build/nginx-1.11.2' gmake[1]: *** [build] Error 2 gmake[1]: Leaving directory `/root/openresty-1.11.2.2/build/nginx-1.11.2' gmake: *** [all] Error 2
究其原因,上面提示的應該是一個source的位置,而不應該是openssl的安裝位置。。。
參考博客:https://www.phpsong.com/2930.html
但是openssl是通過yum install安裝的,沒有存到它的源碼包(還是說我沒找到?)
只能再到官網下載一個,https://www.openssl.org/source/openssl-1.1.1d.tar.gz
找到不你需要的版本沒關系,找到一個版本相近的包,復制其下載鏈接,將后面的openssl版本替換成你需要的即可
(可以通過openssl vesion查看已經安裝了的openssl的版本信息)
最后解壓openssl源碼包到一個位置
最終的 ./configure的參數形式為
./configure --prefix=/opt/openresty \ --with-luajit \ --without-http_redis2_module \ --with-http_iconv_module \ --with-http_postgres_module \ --with-openssl=/OpenResty/package/openssl-1.1.0e
問題解決,希望可以幫到你