I am using nginx:alpine and trying to set my environment variables with:
perl_set $SOME_KEY 'sub { return $ENV{"SOME_KEY"}; }';
in my nginx.conf file. As far as I know (from the Dockerfile) alpine version comes with --with-http_perl_module, but I am getting nginx: [emerg] unknown directive "perl_set" in /etc/nginx/nginx.conf:36. What am I doing wrong?
Loading the module with command nginx -g 'daemon off; load_module /etc/nginx/modules/ngx_http_perl_module-debug.so;' resolved the issue.
Cool, that's what i'm searched. Its would be cool if this tip was present in docker hub nginx main page. Thanks!
using centos and nginx repo, install package nginx-module-perl and load the module
Loading the module with command
nginx -g 'daemon off; load_module /etc/nginx/modules/ngx_http_perl_module-debug.so;'resolved the issue.
Thanks! You made my day.
After hours of searching, I got a Docker container with Nginx and nginx-module-perl.
@eleftrik Hi, you can also use nginx:alpine-perl image, and use the load_module directive in your nginx.conf file, instead of re-defining the CMD.
@eleftrik Hi, you can also use
nginx:alpine-perlimage, and use theload_moduledirective in yournginx.conffile, instead of re-defining the CMD.
Thanks for your feedback. During my attempts, I tried different solutions and each one gave me a different error. Redefining the CMD was the only one that worked for me, but maybe I did some mistakes while trying to find a solution.
Most helpful comment
Loading the module with command
nginx -g 'daemon off; load_module /etc/nginx/modules/ngx_http_perl_module-debug.so;'resolved the issue.