使用http_image_filter_module重新构建nginx,如何在Windows中正确安装GD库并使其对其他



我目前正在尝试用http_image_filter_module重建nginx,但配置有问题定位GD库。

遵循指南:编译NGINX与Visual Studio我终于设法编译NGINX与自定义模块使用MSYS和草莓Perl。我现在只对生成nginx.exe感兴趣,所以只做指南的第1部分。当尝试使用http_image_filter_module(需要GD库)编译时,使用以下命令:

auto/configure --with-cc=cl --builddir=objs --prefix= --conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access.log --error-log-path=logs/error.l
og --sbin-path=nginx.exe --http-client-body-temp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fastcgi-temp-path=temp/fastcgi_temp --with-cc-opt
=-DFD_SETSIZE=1024 --with-pcre=objs/lib/pcre-8.39 --with-zlib=objs/lib/zlib-1.2.8 --with-openssl=objs/lib/openssl-1.0.2j --with-select_module --with-http_ssl_module --with
-http_image_filter_module

显示以下错误:

checking for OS
 + MINGW32_NT-6.2 1.0.19(0.48/3/2) i686
 + using Microsoft Visual C++ compiler
 + cl version: 19.00.24215.1 for x86
checking for MINGW32_NT-6.2 specific features
checking for GD library ... not found
checking for GD library in /usr/local/ ... not found
checking for GD library in /usr/pkg/ ... not found
checking for GD library in /opt/local/ ... not found
auto/configure: error: the HTTP image filter module requires the GD library.
You can either do not enable the module or install the libraries.

我已经从:http://gnuwin32.sourceforge.net/packages/gd.htm运行了GD包的安装程序,但我显然缺少了一两个步骤来工作。

谁能给我指个正确的方向?

解决方法:

  1. 在nginx源目录中打开auto/feature文件,修改

    if [ -x $NGX_AUTOTEST ]; then

    if [ YES ]; then

  2. 在nginx源目录中打开auto/lib/libgd/conf文件,在适当的位置添加代码

    if [ $ngx_found = no ]; then
    
    ngx_feature="GD library in custom path" # 指定libgd头文件位置 ngx_feature_path="/e/thirdparty_source/libgd-2.2.4/src" # 指定libgd库文件位置和库文件 ngx_feature_libs="-L/e/thirdparty_source/gdbuild -lgd" . auto/feature
    
    fi

最新更新