系统环境:CentOS7.2
安装依赖包
1 |
yum install -y libxslt-devel geoip-devel |
1.下载安装LuaJIT-2.0.5.tar.gz
1 2 3 4 |
wget -c http://luajit.org/download/LuaJIT-2.0.5.tar.gz tar xzvf LuaJIT-2.0.5.tar.gz cd LuaJIT-2.0.5 make install PREFIX=/usr/local/luajit |
添加环境变量/etc/profile
1 2 3 4 |
export LUAJIT_LIB=/usr/local/luajit/lib export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0 echo "/usr/local/luajit/lib">>/etc/ld.so.conf ldconfig |
2.下载解压ngx_devel_kit
1 2 |
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz tar -xzvf v0.3.0.tar.gz |
1 2 |
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.11.tar.gz tar -xzvf v0.10.11.tar.gz |
4.下载nginx-goodies-nginx-sticky-module-ng会话保持模块
1 2 |
wget https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/get/08a395c66e42.zip unzip 08a395c66e42.zip |
5.下载nginx_upstream_check_module
1 2 |
wget https://codeload.github.com/yaoweibin/nginx_upstream_check_module/zip/master -O nginx_upstream_check_module.zip unzip nginx_upstream_check_module.zip |
6.下载echo-nginx-module
1 2 |
wget https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz tar -zxvf v0.61.tar.gz |
7.下载openssl
1 2 |
wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2l.tar.gz tar -zxvf openssl-1.0.2l.tar.gz |
8.下载安装nginx-1.12.2.tar.gz(nginx-1.12.2版本需要lua-nginx-module0.10.11)
1 2 3 4 |
wget http://nginx.org/download/nginx-1.12.2.tar.gz tar -xzvf nginx-1.12.2.tar.gz cd nginx-1.12.2 patch -p1 < src/nginx_upstream_check_module-master/check_1.12.1+.patch(根据nginx版本号导入对应补丁) |
1 |
./configure --prefix=/opt/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_geoip_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_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-pcre --with-openssl=src/openssl-1.0.2l --with-http_secure_link_module --with-http_degradation_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/opt/nginx/client_body_temp --http-proxy-temp-path=/opt/nginx/proxy_temp --http-fastcgi-temp-path=/opt/nginx/fastcgi_temp --http-uwsgi-temp-path=/opt/nginx/uwsgi_temp --http-scgi-temp-path=/opt/nginx/scgi_temp --add-module=src/ngx_devel_kit-0.3.0 --add-module=src/lua-nginx-module-0.10.11 --add-module=src/nginx-goodies-nginx-sticky-module-ng-08a395c66e42 --add-module=src/nginx_upstream_check_module-master --add-module=src/echo-nginx-module-0.61 |
1 2 |
make -j2 #根据cpu核数 make install |