如何configurationnginx的embedded式Perl来使用Perl模块?

我已经configurationnginx来使用Perl的特定版本。

$ sudo /opt/nginx/sbin/nginx -V nginx version: nginx/0.8.54 built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46) TLS SNI support disabled configure arguments: --with-debug --with-http_ssl_module --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-perl=/opt/perl/bin/perl --with-http_gzip_static_module --user=apache --group=apache --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --prefix=/opt/nginx 

我创build了两个基于EmbeddedPerlMinifyJS的 Perl模块:MinifyJS.pm和MinifyCSS.pm,它们与nginx.conf文件位于同一目录中。 在configuration文件的http部分,我有以下四行:

 perl_require JavaScript/Minifier.pm; perl_require CSS/Minifier.pm; perl_require MinifyJS.pm; perl_require MinifyCSS.pm; 

在我的服务器部分,我有以下几点:

 location ~ \.js$ { perl MinifyJS::handler; } location ~ \.css$ { perl MinifyCSS::handler; } 

当我启动nginx时,出现一个关于“perl_require”的错误。

 $ sudo /opt/nginx/sbin/nginx [emerg]: unknown directive "perl_require" in /opt/nginx/conf/nginx.conf:31 

那么如何configurationnginx来使用embedded式Perl呢?

(顺便说一句,“perl_modules”也会引发一个未知的指令。)

发布后我立即看到了答案。 运行configure时必须添加--with-http_perl_module (可能还有--with-perl_modules_path )。

这在EmbeddedPerlModule中的“编译时构build模块”一节中find。