Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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
    
Mmm, how do you re-configure perl like this? I'm getting the same error - but I'm unsure of how to tweak Perl. I installed via apt-get, so its a bit new to me :) – Andrew Newby Oct 24 '15 at 10:03
1  
@AndrewNewby I compiled Perl from source code. – Mr. Muskrat Jan 7 at 16:10

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.