SLES 11 SP3 编译安装nginx
首先编译安装依赖软件和包
1. 安装所需编译器
zypper install gcc gcc-c++
2. 编译安装openssl
tar xvf openssl-1.0.2u.tar.gz
cd openssl-1.0.2u
./config -shared
make && make install
3. 编译安装zlib
tar xvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure -shared
make && make install
4. 编译安装pcre
unzip pcre-8.44.zip
cd pcre-8.44
./configure
make && make install
5. 解压需要添加的模块
unzip nginx-goodies-nginx-sticky-module-ng-08a395c66e42.zip
tar xvf nginx-rtmp-module-1.2.1.tar.gz
unzip nginx_upstream_check_module-master.zip
6. upstream_check模块需要在nginx源码上打补丁
vi nginx_upstream_check_module-master/check_1.16.1+.patch
#把所有源码路径前的a/ 和 b/删掉
cd nginx-1.16.1/
patch -p0 < ../nginx_upstream_check_module-master/check_1.16.1+.patch
7. 修改nginx 源码中openssl相关路径
sed -i s/'OPENSSL\/openssl\/include'/'OPENSSL\/include'/g auto/lib/openssl/conf
sed -i s/'OPENSSL\/.openssl\/include'/'OPENSSL\/include'/g auto/lib/openssl/conf
sed -i s/'OPENSSL\/openssl\/lib'/'OPENSSL\/lib'/g auto/lib/openssl/conf
sed -i s/'OPENSSL\/.openssl\/lib'/'OPENSSL\/lib'/g auto/lib/openssl/conf
8. 编译安装nginx
./configure \
--prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-stream_ssl_module \
--with-http_realip_module \
--with-http_secure_link_module \
--with-http_gzip_static_module \
--with-pcre=../pcre-8.44 \
--with-zlib=../zlib-1.2.11 \
--with-openssl=/usr/local/ssl \
--add-module=../nginx_upstream_check_module-master \
--add-module=../nginx-goodies-nginx-sticky-module-ng-08a395c66e42 \
--add-module=../nginx-rtmp-module-1.2.1 \
--with-stream
make && make install