我在 CentOS 7 机器上运行 nginx 版本 1.10.2。当我尝试启动该服务时,出现以下错误:
Aug 15 16:08:50 user.mylabserver.com nginx[2704]: 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/vend
Aug 15 16:08:50 user.mylabserver.com nginx[2704]: BEGIN failed--compilation
aborted.
Aug 15 16:08:50 user.mylabserver.com nginx[2704]: nginx: [alert]
perl_parse() failed: 2
Aug 15 16:08:50 user.mylabserver.com systemd[1]: nginx.service: main process
exited, code=exited, status=1/FAILURE
Aug 15 16:08:50 user.mylabserver.com systemd[1]: Unit nginx.service entered
failed state.
Aug 15 16:08:50 user.mylabserver.com systemd[1]: nginx.service failed.
答案1
日志的相关部分是:
Aug 15 16:08:50 user.mylabserver.com nginx[2704]: 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/vend
第一行表明服务启动失败,因为找不到该文件nginx.pm
。
其余部分具体指示它在其中寻找该文件的确切位置。
如果该文件不存在于任何这些目录中,则表明该服务的某个组件已被(重新)移动
如果它确实存在,则您可能没有以有权查看或读取所需文件的用户身份启动该服务。