Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have configured nginx to use a specific version of 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

I created two Perl modules based on EmbeddedPerlMinifyJS: MinifyJS.pm and MinifyCSS.pm which are in the same directory as the nginx.conf file. Inside the http section of the config file I have the following four lines:

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

In my server section I have the following:

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

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

When I start nginx, I get an error about "perl_require".

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

So how do I configure nginx to use the embedded Perl?

(BTW, "perl_modules" also throws an unknown directive.)

share|improve this question

1 Answer 1

I saw the answer immediately after posting. You have to add --with-http_perl_module (and possibly --with-perl_modules_path) when running configure.

This was found at EmbeddedPerlModule in the section entitled "Building Module at Compile-time".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.