Nginx配置https会报错:parameter requires ngx_http_ssl_module

按要求修改nginx配置文件,配置https的时候,发现报错了。

[root@localhost sbin]#

systemctl restart nginx Job for nginx.service failed because the control process exited with error code.

See "systemctl status nginx.service" and "journalctl -xe" for details.

这才知道安装nginx的时候没有带上--with-http_ssl_module,导致无法将nginx配置文件修改为https的。

现在nginx已经安装,只是缺少了http_ssl_module模块。

解决方法,补充缺失的模块:

1. cd /usr/local/nginx-1.21.1 找到当前路径

2.添加新配置

bash ./configure --prefix=/usr/local/nginx  --with-http_ssl_module


3.运行完一定要make,而不是make install

4.备份nginx
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

5.停止正在运行的nginx进程

systemctl stop nginx

6.将编译好的nginx覆盖原有的nginx
cp ./objs/nginx /usr/local/nginx/sbin/

7.将nginx.conf配置文件中修改为https

 8.验证conf文件是否存在问题

[root@localhost sbin]# ./nginx -t
如果配置文件中没有语法错误,将会显示 "nginx: configuration file /path/to/nginx.conf test is successful"。

9.重启nginx服务

systemctl start nginx

systemctl stauts nginx 查看运行状态

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值