building ngx_cache_purge module on CentOS Linux release 7.9.2009 (Core)

Kaushal Shriyan kaushalshriyan at gmail.com
Sun May 8 03:10:44 UTC 2022


Hi Sergey,

I followed
https://www.nginx.com/blog/compiling-dynamic-modules-nginx-plus/#load_module
to generate the third party dynamic module

Nginx Version :- nginx version: nginx/1.20.1
OS Version :- CentOS Linux release 7.9.2009 (Core)

cd /home/kaushal/ngx-cache-purge/
# ls -l
total 64
-rw-r--r-- 1 root root   728 May  8 02:48 config
-rw-r--r-- 1 root root 51501 May  8 02:48 ngx_cache_purge_module.c
-rw-r--r-- 1 root root  5090 May  8 02:48 README.md
# cat config
if [ "$HTTP_PROXY" = "YES" ]; then
    have=NGX_HTTP_PROXY . auto/have
fi

if [ "$HTTP_FASTCGI" = "YES" ]; then
    have=NGX_HTTP_FASTCGI . auto/have
fi

if [ "$HTTP_SCGI" = "YES" ]; then
    have=NGX_HTTP_SCGI . auto/have
fi

if [ "$HTTP_UWSGI" = "YES" ]; then
    have=NGX_HTTP_UWSGI . auto/have
fi

if test -n "$ngx_module_link"; then
    ngx_module_type=HTTP
    ngx_module_name=ngx_http_cache_purge_module
    ngx_module_srcs="$ngx_addon_dir/ngx_cache_purge_module.c"

    have=NGX_CACHE_PURGE_MODULE . auto/have

    . auto/module
else
    HTTP_MODULES="$HTTP_MODULES ngx_http_cache_purge_module"
    NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_cache_purge_module.c"

    have=NGX_CACHE_PURGE_MODULE . auto/have
fi
#

#wget http://nginx.org/download/nginx-1.20.2.tar.gz
#tar zxvf nginx-1.20.2.tar.gz
#cd /home/kaushal/nginx-1.20.2/
#./configure --with-compat --add-dynamic-module=../ngx-cache-purge

#cat /usr/share/nginx/modules/ngx-http-cache-purge-module.conf
load_module "/usr/lib64/nginx/modules/ngx_http_cache_purge_module.so";

#cat /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

#nginx -t -c /etc/nginx/nginx.conf
nginx: [emerg] module
"/usr/lib64/nginx/modules/ngx_http_cache_purge_module.so" version 1020002
instead of 1020001 in
/usr/share/nginx/modules/ngx-http-cache-purge-module.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed

Please correct and guide me if I am missing something. Thanks in advance.

Best Regards,

Kaushal

On Sat, May 7, 2022 at 7:32 PM Sergey A. Osokin <osa at freebsd.org.ru> wrote:

> Hi Kaushal,
>
> On Sat, May 07, 2022 at 06:31:59PM +0530, Kaushal Shriyan wrote:
> >
> > #gcc -o ngx_cache_purge_module ngx_cache_purge_module.c
> > ngx_cache_purge_module.c:30:19: fatal error: nginx.h: No such file or
> > directory
> >  #include <nginx.h>
> >                    ^
> > compilation terminated.
>
> I'd recommend to follow this [1] blog post to create a dynamic module
> for nginx.
>
> References:
> 1. https://www.nginx.com/blog/compiling-dynamic-modules-nginx-plus/
>
> --
> Sergey A. Osokin
> _______________________________________________
> nginx mailing list -- nginx at nginx.org
> To unsubscribe send an email to nginx-leave at nginx.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20220508/c477632a/attachment.htm>


More information about the nginx mailing list