Nginx配置SSL报错 nginx: [emerg] unknown directive “ssl“_ssl证书

 

出现如图所示错误,处理办法如下

去nginx解压目录下执行

./configure --with-http_ssl_module

Nginx配置SSL报错 nginx: [emerg] unknown directive “ssl“_nginx_02

 

如果报错 ./configure: error: SSL modules require the OpenSSL library.则执行

yum -y install openssl openssl-devel

./configure

./configure --with-http_ssl_module

执行 make(切记不能 make install 会覆盖安装目录)

将原来 nginx 备份

cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak

将新的 nginx 覆盖旧安装目录

cp objs/nginx /usr/local/nginx/sbin/nginx

Nginx配置SSL报错 nginx: [emerg] unknown directive “ssl“_nginx_03

 

如果报错,执行 cp -rfp objs/nginx /usr/local/nginx/sbin/nginx

测试 nginx 是否正确

/usr/local/nginx/sbin/nginx -t

Nginx配置SSL报错 nginx: [emerg] unknown directive “ssl“_干货_04

 

如图最后是测试成功的,之前遇到一个错误是我的SSL证书路径有错,修改后测试通过