lnmp升级nginx引起的 nginx:Can't locate nginx.pm 错误

如果启动nginx报错:

正在启动 nginx:Can't locate nginx.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.
nginx: [alert] perl_parse() failed: 2
                                                           [失败]

这是因为没有make install,导致http_perl_module加载异常,需要将以下文件复制到指定目录

mkdir -p /usr/local/lib64/perl5/auto/nginx
cp objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.bs objs/src/http/modules/perl/blib/arch/auto/nginx/nginx.so /usr/local/lib64/perl5/auto/nginx/
cp objs/src/http/modules/perl/blib/lib/nginx.pm /usr/local/lib64/perl5/

然后重新启动nginx

posted @ 2019-10-27 21:44  咳嗽的小鱼  阅读(1852)  评论(0编辑  收藏  举报