Linux Nginx 编译安装模块

毛弘博
2023-12-01

Linux Nginx 编译安装

需要的扩展

yum install zlib-devel gd-devel pcre-devel pcre openssl-devel lua lua-devel

下载第三方模块

下载好后,直接解压,无需编译安装,可以修改下文件夹名,供后面Nginx编译时使用;编译时使用add-module 指定解压后的目录;
模块如下:需要在nginx.conf 中使用到 echo/set 命令时,需要以下扩展

https://github.com/openresty/set-misc-nginx-module/archive/v0.32.tar.gz
https://github.com/simplresty/ngx_devel_kit/archive/v0.3.1rc1.tar.gz
https://github.com/openresty/echo-nginx-module/archive/v0.61.tar.gz

Nginx官网扩展:https://www.nginx.com/resources/wiki/modules/index.html

编译安装Nginx

wget 'http://nginx.org/download/nginx-1.14.2.tar.gz'
tar -xzvf nginx-1.14.2.tar.gz
cd nginx-1.14.2/

编译配置

官网文档写到

–add-module=/path/to/set-misc-nginx-module
这里的“/path/to” 指的是模块的路径

./configure --prefix=/usr/local/nginx \
--with-http_stub_status_module \
--with-http_ssl_module \
--add-module=../ngx_devel_kit \
--add-module=../set-misc-nginx-module \
--add-module=../echo-nginx-module \
--with-pcre=/usr/local/src/pcre-8.35

安装

make -j2
make install

启动Nginx

ln -s /usr/local/nginx/sbin/nginx /etc/nginx
启动:nginx
停止:nginx -s stop

最后,好好玩,嘟嘟嘟!

 类似资料: