nginx1.16 + lua

centos 7.6 x64

nginx1.16 + lua
模块
ngx_devel_kit-master
ngx_cache_purge
nginx-http-sysguard
nginx-http-concat
lua-nginx-module-0.10.14
echo-nginx-module-0.61

mkdir -p /data/nginx/modules_nginx && mkdir -p /data/Package && cd /data/Package/
yum -y install gcc gcc-c++ automake autoconf libtool make GeoIP GeoIP-devel GeoIP-data

模块:ngx_devel_kit
wget -c https://github.com/simpl/ngx_devel_kit/archive/master.zip -O ngx_devel_kit.zip
unzip -d /data/nginx/modules_nginx/ ngx_devel_kit.zip

模块:lua-nginx-module
https://github.com/openresty/lua-nginx-module/tags
tar -zxvf lua-nginx-module-0.10.14.tar.gz -C /data/nginx/modules_nginx/

模块echo-nginx-module
https://github.com/openresty/echo-nginx-module/tags
tar -zxvf echo-nginx-module-0.61.tar.gz -C /data/nginx/modules_nginx/

模块 ngx_cache_purge
git clone https://github.com/FRiCKLE/ngx_cache_purge.git
模块nginx-http-concat
git clone https://github.com/alibaba/nginx-http-concat.git
模块 nginx-http-sysguard
git clone https://github.com/alibaba/nginx-http-sysguard.git
mv nginx-http-concat/ nginx-http-sysguard/ ngx_cache_purge/ /data/nginx/modules_nginx/

wget http://soft.xiaoz.org/linux/jemalloc-5.2.0.tgz
tar -zxvf jemalloc-5.2.0.tgz -C /data/nginx/modules_nginx/
mkdir -p /data/nginx/modules_nginx/jemalloc
./configure --prefix=/data/nginx/modules_nginx/jemalloc --libdir=/usr/local/lib
make -j4 && make -j4 install

git clone https://github.com/openresty/luajit2
mkdir /data/nginx/modules_nginx/luajit2.1
cd /data/nginx/modules_nginx/luajit2
make -j4 PREFIX=/data/nginx/modules_nginx/luajit2.1
make -j4 install PREFIX=/data/nginx/modules_nginx/luajit2.1
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig -v

vim /etc/profile
# luajit
export LUAJIT_LIB=/data/nginx/modules_nginx/luajit2.1/lib
export LUAJIT_INC=/data/nginx/modules_nginx/luajit2.1/include/luajit-2.1
export PATH=/data/nginx/modules_nginx/luajit2.1/bin/luajit:$PATH

# nginx
export PATH=/data/nginx/sbin/:$PATH
source /etc/profile

wget -c http://www.zlib.net/zlib-1.2.11.tar.gz
tar -zxvf zlib-1.2.11.tar.gz -C /data/nginx/modules_nginx/
./configure --prefix=/data/nginx/modules_nginx/zlib-1.2.11
make -j4 && make -j4 install

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz
tar -zxvf pcre-8.38.tar.gz -C /data/nginx/modules_nginx/
./configure
make -j4 && make -j4 install

wget -c http://nginx.org/download/nginx-1.16.0.tar.gz
useradd -M -s /sbin/nologin nginx
tar -zxvf nginx-1.16.0.tar.gz
cd /data/nginx/nginx-1.16.0

./configure --prefix=/data/nginx --user=nginx --group=nginx \
--conf-path=/data/nginx/conf/nginx.conf \
--with-http_geoip_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_geoip_module \
--with-http_mp4_module \
--with-http_image_filter_module \
--with-stream \
--with-stream_geoip_module \
--without-http_limit_conn_module \
--without-http_limit_req_module \
--without-http_upstream_zone_module \
--without-http_upstream_keepalive_module \
--without-http_upstream_random_module \
--without-http_upstream_least_conn_module \
--without-http_upstream_ip_hash_module \
--without-http_upstream_hash_module \
--with-stream_geoip_module \
--with-ld-opt=-ljemalloc \
--with-pcre=/data/nginx/modules_nginx/pcre-8.38 \
--with-zlib=/data/nginx/modules_nginx/zlib-1.2.11 \
--with-ld-opt=-Wl,-rpath,/data/nginx/modules_nginx/luajit2.1/lib \
--add-module=/data/nginx/modules_nginx/ngx_devel_kit-master \
--add-module=/data/nginx/modules_nginx/ngx_cache_purge \
--add-module=/data/nginx/modules_nginx/nginx-http-concat \
--add-module=/data/nginx/modules_nginx/lua-nginx-module-0.10.14 \
--add-module=/data/nginx/modules_nginx/echo-nginx-module-0.61 \
--add-module=/data/nginx/modules_nginx/nginx-http-sysguard

拷贝到编译目录,安装nginx-http-sysguard模块就必须打补丁
cp ../modules_nginx/nginx-http-sysguard/nginx_sysguard_1.3.9.patch .
查看文件找到需要打补丁的文件,并列出文件的绝对路径
cat nginx_sysguard_1.3.9.patch
开始打补丁
patch < nginx_sysguard_1.3.9.patch

此处提示"File to patch:"让你输入文件的路径.,输入补丁文件的详细地址
/data/nginx/nginx-1.16.0/src/http/ngx_http_request.h
make -j4
make -j4 install

#如果需要扩展成多节点nginx,只需要直接拷贝/data/目录就可以,然后带上/etc/profile的变量和/etc/ld.so.conf 的库
[root@k8s nginx-1.16.0]# which nginx
/data/nginx/sbin/nginx

[root@k8s nginx-1.16.0]# nginx -t
nginx: the configuration file /data/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /data/nginx/conf/nginx.conf test is successful
[root@k8s nginx-1.16.0]# nginx -c /data/nginx/conf/nginx.conf
[root@k8s nginx-1.16.0]# ps -fe |grep nginx
root 30675 1 0 18:52 ? 00:00:00 nginx: master process nginx -c /data/nginx/conf/nginx.conf
nginx 30676 30675 0 18:52 ? 00:00:00 nginx: worker process
root 30684 8752 0 18:52 pts/0 00:00:00 grep --color=auto nginx

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值