---
title: 编译Nginx时提示未添加ngx_http_ssl_module的解决方法
description: "已经编译安装好的Nginx，在添加未被编译的模块时，提示未添加ngx_http_ssl_module。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengwebs/troubleshooting/trouble/kunpengwebs_09_0005.html
sourcePath: /source/zh/kunpengwebs/troubleshooting/trouble/kunpengwebs_09_0005.html
indexId: 54a03f21ca30a7cc1078a230343f0b9aa0fa21b35128c41b98fe14adcd6fe08e71
---
# 编译Nginx时提示未添加ngx_http_ssl_module的解决方法

#### 问题现象描述

已经编译安装好的Nginx，在添加未被编译的模块时，提示未添加ngx_http_ssl_module。

提示信息如下：

```
nginx: [emerg] the "ssl" parameter requires ngx_http_ssl module in /usr/local/nginx/conf/nginx.conf:100
```


本例中Nginx的安装目录为/“usr/local/nginx”，源码包所在目录为“/home/nginx-1.14.2”。


#### 关键过程、根本原因分析

Nginx缺少http_ssl_module模块，编译安装的时候带上--with-http_ssl_module配置即可。


#### 结论、解决方案及效果

- 方法一：

  1. 查看Nginx原有的模块。

```
/usr/local/nginx/sbin/nginx -V
```


  2. 添加http_ssl_module模块。

```
./configure  --with-http_ssl_module
```


  3. 配置完成后，编译Nginx。
    此处请不要执行make install命令，该命令为覆盖安装命令。请先使用如下命令备份原有已安装好的Nginx。 cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

```
make
```


  4. 停止Nginx。

```
/usr/local/nginx/sbin/nginx -s quit
```


  5. 将编译好的Nginx覆盖掉原有的Nginx。

```
cp ./objs/nginx /usr/local/nginx/sbin/
```


    当系统提示是否覆盖时，输入“yes”即可。

  6. 启动Nginx，查看http_ssl_module模块是否已经加入成功。

```
/usr/local/nginx/sbin/nginx -V
```


- 方法二：直接添加http_ssl_module模块，然后重新编译安装Nginx。

  1. 执行configure脚本。

```
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --with-http_perl_module --with-pcre  --with-openssl=/home/openssl-1.1.1a
```


  2. 编译安装Nginx。

```
make -j80 && make install
```
