前言:配置Nginx + sll 报错nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.conf:43
,本章将详细说明如何解决
一、报错演示
二、问题解决
-
去nginx解压目录下执行
如果删了就去在下载吧
./configure --with-http_ssl_module
如果报错
./configure: error: SSL modules require the OpenSSL library.
则执行下边的yum -y install openssl openssl-devel ./configure ./configure --with-http_ssl_module
-
执行 make(切记不能 make install 会覆盖安装目录)
make
-
将原来 nginx 备份
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
-
将新的 nginx 覆盖旧安装目录
cp -rfp objs/nginx /usr/local/nginx/sbin/nginx
-
测试 nginx 是否正确
/usr/local/nginx/sbin/nginx -t
错误运行结果(说明配置失败):
[root@localhost nginx-1.9.9]# /usr/local/nginx/sbin/nginx -t nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.conf:43 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed [root@localhost nginx-1.9.9]#
正确运行结果(说明配置成功):
[root@localhost nginx-1.9.9]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@localhost nginx-1.9.9]#
-
到这里问题就解决了