nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.conf:41
nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
这是因为nginx缺少http_ssl_module模块,编译安装时带上淡出--with-http_ssl_module配置就行了,但是如果已经安装过了nginx,怎么添加模块呢?
1.切换到源码包:
cd /opt/nginx/nginx-1.10.2/(替换为自己的源码包目录即可)
2.查看nginx原有的模块
nginx -V
原有配置信息如下:
--pref=/usr/local/nginx
3.运行命令:./configure --pref=/usr/local/nginx --with-http_ssl_module
4.运行make(这里不要make install,否则会覆盖安装)
5.备份原有已安装好的nginx:cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
6.停止nginx运行:nginx -s stop
7.将刚刚编译好的nginx覆盖掉原有的nginx:cp ./objs/nginx /usr/local/nginx/sbin/nginx
8.启动nginx:nginx
9.运行:nginx -V 查看是否已成功加入
原文地址:https://www.cnblogs.com/houkaihua/p/11779147.html
时间: 2024-11-08 05:16:57