nginx源码安装和openssl源码安装,http2支持
nginx源码安装和openssl源码安装,http2支持
首先是openssl源码安装
mv /usr/bin/openssl /usr/bin/openssl.old mv /usr/include/openssl /usr/include/openssl.old wget https://www.openssl.org/source/openssl-1.1.0g.tar.gz tar zxvf openssl-1.1.0g.tar.gz cd openssl-1.1.0g/ ./config --prefix=/usr/local/openssl shared zlib make depend make && make install ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl ln -s /usr/local/openssl/include/openssl /usr/include/openssl(首选) cd /usr/local/openssl/lib ln -s libssl.so.1.1 libcrypto.so.1.1 /lib/ echo /usr/local/openssl/lib >> /etc/ld.so.conf ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1 ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1 openssl version
nginx源码安装
下载源码包
wget http://nginx.org/download/nginx-1.12.2.tar.gz
解压编译安装
编译安装 nginx 时,–with-openssl 参数默认只支持OpenSSL的源代码,不支持已编译好的 OpenSSL。可以在nginx的解压目录下修改auto/lib/openssl/conf
sed "s/.openssl\///" c
将文件中的.openssl去掉,就可以支持编译之后的openssl路径了,去掉".openssl/"
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"
到达nginx安装目录,正式编译
./configure --prefix=/etc/nginx \ --sbin-path=/usr/sbin/nginx \ --conf-path=/etc/nginx/nginx.conf \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --pid-path=/var/run/nginx.pid \ --lock-path=/var/run/nginx.lock \ --http-client-body-temp-path=/var/cache/nginx/client_temp \ --http-proxy-temp-path=/var/cache/nginx/proxy_temp \ --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \ --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \ --http-scgi-temp-path=/var/cache/nginx/scgi_temp \ --with-http_ssl_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_random_index_module \ --with-http_secure_link_module \ --with-http_stub_status_module \ --with-http_auth_request_module \ --with-threads \ --with-stream \ --with-stream_ssl_module \ --with-http_slice_module \ --with-mail \ --with-mail_ssl_module \ --with-file-aio \ --with-http_v2_module \ --with-openssl=/usr/local/openssl make && make install
本文参考
https://blog.csdn.net/whisshe/article/details/79743060