openssl升級1.0.2k及nginx1.14.0編譯安裝

openssl編譯安裝

tar -zxvf openssl-1.0.2l.tar.gz 
./config --prefix=/usr/local/openssl
#注意若是有問題,會顯示出來,通常是perl版本問題
make && make install
#重命名原來的openssl命令
mv /usr/bin/openssl /usr/bin/openssl.old
#重命名原來的openssl目錄
mv /usr/include/openssl /usr/include/openssl.old
#將安裝好的openssl 的openssl命令軟連到/usr/bin/openssl
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl
#將安裝好的openssl 的openssl目錄軟連到/usr/include/openssl
ln -s /usr/local/ssl/include/openssl /usr/include/openssl
#修改系統自帶的openssl庫文件,如/usr/local/lib64/libssl.so(根據機器環境而定) 軟鏈到升級後的libssl.so
ln -s /usr/local/ssl/lib/libssl.so /usr/local/lib64/libssl.so
#執行命令查看openssl依賴庫版本是否爲1.0.1g:
strings /usr/local/lib64/libssl.so |grep OpenSSL
#在/etc/ld.so.conf文件中寫入openssl庫文件的搜索路徑
echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
#使修改後的/etc/ld.so.conf生效
ldconfig -vnginx

nginx編譯安裝

/usr/local/nginx/sbin/nginx -V
cd /opt/nginx-1.14.0
./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf --http-log-path=/usr/local/nginx/log/access.log --error-log-path=/usr/local/nginx/log/error.log --lock-path=/usr/lcoal/nginx/log/nginx.lock --pid-path=/usr/local/nginx/nginx.pid --http-client-body-temp-path=/usr/local/nginx/body --http-fastcgi-temp-path=/usr/local/nginx/fastcgi --http-proxy-temp-path=/usr/local/nginx/proxy --http-scgi-temp-path=/usr/local/nginx/scgi --http-uwsgi-temp-path=/usr/local/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gunzip_module --with-http_gzip_static_module  --with-http_v2_module --with-http_sub_module --with-http_xslt_module --with-stream --with-stream_ssl_module --with-mail --with-mail_ssl_module --with-threads --with-openssl=/usr/local/openssl
make
#千萬別make install,不然就覆蓋安裝了
cp /usr/local/nginx/sbin/nginx  /usr/local/nginx/sbin/nginx.bak
ps -ef |grep nginx
#查看master進程號XX
kill -QUIT  XXX
cp /opt/nginx-1.14.0/objs/nginx /usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginxui


make的時候編譯報錯了,參考如下方法解決

[/usr/local/openssl//.openssl/include/openssl/ssl.h] Error 127spa


解決Nginx添加openssl模塊編譯時報錯問題   debug

/bin/sh: line 2: ./config: No such file or directory
make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 127
make[1]: Leaving directory `/usr/local/src/nginx-1.9.9'
make: *** [build] Error 2

/ssl/這個目錄能夠發現這個目錄下是沒有.openssl目錄的,所以咱們修改Nginx編譯時對openssl的路徑選擇就能夠解決這個問題了blog

解決方案:
打開nginx源文件下的/usr/local/src/nginx-1.9.9/auto/lib/openssl/conf文件:
找到這麼一段代碼:
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"進程

CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"ip

CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"ssl

CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"openssl

CORE_LIBS="$CORE_LIBS $NGX_LIBDL"string

修改爲如下代碼:

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"

CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

 而後再進行Nginx的編譯安裝便可

相關文章
相關標籤/搜索