未知指令“perl_modules”

前端之家收集整理的这篇文章主要介绍了未知指令“perl_modules”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
尝试使用以下/etc/Nginx/Nginx.conf设置启动Nginx时,我收到一个未知指令“perl_modules”错误
user  Nginx;
worker_processes  1;

error_log  /var/log/Nginx/error.log warn;
pid        /var/run/Nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/Nginx/mime.types;
    default_type  application/octet-stream;

    perl_modules perl/lib;

    perl_set $subdomain_uppercase 'sub {
        my $r = shift;
        my $subdomain = $r->subdomain;
        $subdomain = uc($subdomain);
        return $subdomain;
    }';

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/Nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/Nginx/conf.d/*.conf;
}

我已经安装perl:

root@0f0babe794c4:/etc/Nginx# perl -v

This is perl 5,version 20,subversion 2 (v5.20.2) built for x86_64- linux-gnu-thread-multi
 (with 92 registered patches,see perl -V for more detail)

并且它看起来像在我的Nginx设置中启用了模块:

root@0f0babe794c4:/etc/Nginx# Nginx -V
Nginx version: Nginx/1.9.15
built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1k 8 Jan 2015
TLS SNI support enabled
configure arguments: --prefix=/etc/Nginx --sbin-path=/usr/sbin/Nginx --modules-path=/usr/lib/Nginx/modules --conf-path=/etc/Nginx/Nginx.conf --error-log-path=/var/log/Nginx/error.log --http-log-path=/var/log/Nginx/access.log --pid-path=/var/run/Nginx.pid --lock-path=/var/run/Nginx.lock --http-client-body-temp-path=/var/cache/Nginx/client_temp --http-proxy-temp-path=/var/cache/Nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/Nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/Nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/Nginx/scgi_temp --user=Nginx --group=Nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_perl_module=dynamic --add-dynamic-module=debian/extra/njs-1c50334fbea6/Nginx --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_v2_module --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2' --with-ld-opt='-Wl,-z,relro -Wl,--as-needed'

值得注意的是,上面包含–with-http_perl_module = dynamic.

我没有额外的步骤来让这个perl模块启用,所以我可以设置动态变量?

解决方法

您将ngx_http_perl_module安装为动态模块(–with-http_perl_module = dynamic),因此您需要在Nginx.conf开头加载此模块:
load_module /usr/lib/Nginx/modules/ngx_http_perl_module.so

我使用了–modules-path选项的路径,所以检查这个目录来获取http_perl模块文件的确切名称

原文链接:https://www.f2er.com/Perl/172606.html

猜你在找的Perl相关文章