nginx配置https模块
1.问题复现
配置https时出现nginx: [emerg] the “ssl” parameter requires ngx_http_ssl_modul
2.问题原因
nginx 缺少https模块
执行./nginx -V
从上述nginx 版本信息中能查看到缺少https模块
3.解决问题
3.1 找到nginx下的包含configure目录
find / -name 'configure' | grep nginx
![](https://img-blog.csdnimg.cn/20210123112937471.png)
3.2 进入到上面查询到的目录
cd /home/hhdev/nginx-1.14.0/configure
3.3 执行添加ssl模块命令
将执行./nginx -V 的结果中configure arguments 后面添加
–with-http_stub_status_module --with-http_ssl_module
./configure --prefix=/home/hhdev/nginx --with-http_stub_status_module --with-http_ssl_module
3.4 编译
make
3.5 验证编译完后的nginx版本信息
./objs/nginx -V
执行结果如下
才证明前面的操作没有问题
3.6 将原来./nginx 文件备份
cp /home/hhdev/nginx/sbin/nginx /home/hhdev/nginx/sbin/nginx.bak
3.7 将原来的nginx 进程杀掉
3.7.1 查询nignx的进程
ps -ef| grep nginx
![](https://img-blog.csdnimg.cn/20210123114443729.png)
3.7.2 杀掉nginx的进程
kill -9 1932 1933
3.8 将安装完成后的nginx 文件复制过去
cp -rfp objs/nginx /home/hhdev/nginx/sbin/nginx
3.9 启动nginx
./home/hhdev/nginx/sbin/nginx
不报错就是说明启动成功了
4. 可能遇到的问题点
4.1 执行完./configure --prefix=/home/hhdev/nginx --with-http_stub_status_module --with-http_ssl_module但是执行 ./objs/nginx时找不到没有ssl模块
解决方案:没有执行make 命令
4.2 把原来的nginx 添加的模块给覆盖了
解决方案: 只能重新添加模块了,下次添加模块的时候不能执行make install
4.3 执行./objs/nginx -V 有ssl模块 但是执行./nginx -s reload 仍然报错
解决方案: 把nginx 杀掉然后在执行./nginx