nginx启动报 ssl parameter requires ngx_http_ssl_module

更新网站安全证书时报上面的错,解决步骤:

问题分析

原因:nginx缺少http_ssl_module模块,编译安装的时候带上--with-http_ssl_module配置就行了,但是现在的情况是我的nginx已经安装过了,怎么添加模块?以我的nginx为例子

①nginx的安装目录是/usr/local/nginx这个目录,

②源码包在/usr/local/src/nginx-1.8.0目录

解决过程

注:

1、如果是使用yum 安装等方式,找不到源码包,需要下载当前安装相同版本的源码包:

复制代码
wget http://nginx.org/download/nginx-1.8.0.tar.gz

使用nginx -V查询当前Nginx的编译配置信息,configure arguments: 后面为当前运行Nginx的配置信息

复制代码
(base) [root@iZxpl4sxxnloovZ nginx-1.8.0]# nginx -V
nginx version: nginx/1.8.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
configure arguments: --prefix=/usr/local/nginx

2、 切换到源码目录:

复制代码
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

执行结果如下:

复制代码
(base) [root@iZxpl4sxxnloovZ nginx-1.8.0]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
checking for OS
 + Linux 3.10.0-1062.9.1.el7.x86_64 x86_64
checking for C compiler ... found
 + using GNU C compiler
 + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
  ... 省略部分
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

3、编译 : make (这里不要进行make install,否则就是覆盖安装)

复制代码
(base) [root@iZxpl4sxxnloovZ nginx-1.8.0]# make
make -f objs/Makefile
make[1]: Entering directory `/usr/local/src/nginx-1.8.0'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/core/nginx.o \
        src/core/nginx.c
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g  -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/core/ngx_log.o \

4、 备份原来nginx配置文件

复制代码
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

5、保证nginx是关闭状态
nginx -s stop

如果无法关闭,可以使用杀死进程方式关闭:ps -ef | grep nginx

进程

强制退出:kill -9 nginx

6、复制刚编译生成的配置覆盖原有的配置

复制代码
cp ./objs/nginx /usr/local/nginx/sbin/

(其中/usr/local/nginx/sbin/路径是你所使用的Nginx所在的位置。比如我不用/usr/local/nginx中的Nginx,只需将路径修改至或者复制到你所使用的Nginx的sbin位置即可)

7、启动nginx : nginx

相关推荐
2501_9159214316 分钟前
iOS IPA 混淆实测分析:从逆向视角验证加固效果与防护流程
websocket·网络协议·tcp/ip·http·网络安全·https·udp
2501_9159184116 分钟前
打造可观测的 iOS CICD 流程:调试、追踪与质量保障全记录
websocket·网络协议·tcp/ip·http·网络安全·https·udp
小小鱼儿小小林4 小时前
免费一键自动化申请、续期、部署、监控所有 SSL/TLS 证书,ALLinSSL开源免费的 SSL 证书自动化管理平台
开源·自动化·ssl
RW~4 小时前
Minio安装配置,桶权限设置,nginx代理 https minio
运维·nginx·https·minio
2501_915909064 小时前
调试 WebView 旧资源缓存问题:一次从偶发到复现的实战经历
websocket·网络协议·tcp/ip·http·网络安全·https·udp
小湘西5 小时前
Apache HttpClient 的请求模型和 I/O 类型
java·http·apache
cliffordl5 小时前
MCP 传输机制(Streamable HTTP)
网络·网络协议·http
CodeWithMe6 小时前
Nginx入门进阶:从零到高手的实战指南
运维·nginx
Ahlson6 小时前
【fnNAS】docker的nginx配置html
nginx·docker·容器·fnnas
2501_915921437 小时前
请求未达服务端?iOS端HTTPS链路异常的多工具抓包排查记录
websocket·网络协议·tcp/ip·http·网络安全·https·udp