查看nginx的信息,包括版本号和configure编译配置信息
nginx -V
cd到源码目录执行,./configure
后面就是要添加的模块
./configure –-with-http_ssl_module --with-http_image_filter_module
configure完成后执行编译
sudo make
记住不用install
编译后的nginx在当前目录的objs文件夹内。
备份/usr/local/nginx/sbin/
目录下的nginx
把编译后的objs
文件夹内的nginx
文件移动到/usr/local/nginx/sbin/
文件夹内
重启nginx
nginx -s stop
nginx
运行nginx -V
发现已经包含需要的模块了
备注:
安装http_image_filter_module
模块报错error: the HTTP image filter module requires the GD library.
解决方法:
安装:libgd-dev
sudo apt install libgd-dev