nginx编译及安装问题集锦
目录
问题一、error: the HTTP rewrite module requires the PCRE library.
问题二、error: the HTTP gzip module requires the zlib library.
问题三、invalid PID number "" in "/apps/srv/nginx1.18/logs/nginx.pid"
问题四、unknown directive "ssl_certificate"
问题五、open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
问题一、error: the HTTP rewrite module requires the PCRE library.
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
解决:
yum -y install pcre-devel
截图:
问题二、error: the HTTP gzip module requires the zlib library.
./configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.
解决:
yum install -y zlib-devel
截图:
问题三、invalid PID number "" in "/apps/srv/nginx1.18/logs/nginx.pid"
2021/06/02 14:04:11 [notice] 21603#0: signal process started
2021/06/02 14:04:11 [error] 21603#0: invalid PID number "" in "/apps/srv/nginx1.18/logs/nginx.pid"
解决:
没有找到PID对应的nginx进程,所以,如果我们想重启nginx服务的话是有问题的。
我们可以直接运行如下命令启动nginx服务:
./nginx
而不是使用:
./nginx -s reload
当然还有另外一种可能,就是已经存在nginx服务干扰了新服务启动,我们可以使用如下命令查看当前nginx服务的运行状态:
ps -aux | grep nginx
然后,根据PID,干掉对应的nginx服务,再重新启动nginx服务。
kill -9 pid
截图:
问题四、unknown directive "ssl_certificate"
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
2021/06/02 14:23:02 [emerg] 21702#0: unknown directive "ssl_certificate" in /etc/nginx/conf.d/test-oss-01.test.cn.conf:21
解决:
比较常见的原因是证书路径不对或者编译nginx过程中没有指定ssl模块。
如果是前者的话,我们可以修改 test-oss-01.test.cn.conf 配置文件中引用的 *.crt 和 *.key 的路径。
如果是后者的话,我们可以使用如下命令设置编译选项,再执行 make 命令重新编译。
./configure --with-http_ssl_module //重新添加这个ssl模块
截图:
问题六、open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)
解决:
执行命令前边增加sudo即可
文章来源: liuzhen.blog.csdn.net,作者:Data-Mining,版权归原作者所有,如需转载,请联系作者。
原文链接:liuzhen.blog.csdn.net/article/details/117449908
- 点赞
- 收藏
- 关注作者
评论(0)