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

来自:互联网
时间:2019-08-29
阅读:

<a href=https://www.freexyz.cn/tag/Nginx.html target=_blank class=infotextkey>Nginx</a>配置SSL报错 nginx: [emerg] unknown directive “ssl”

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

1.去nginx解压目录下执行

./configure --with-http_ssl_module

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

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

yum -y install openssl openssl-devel

./configure

./configure --with-http_ssl_module

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

4.将原来 nginx 备份

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

5.将新的 nginx 覆盖旧安装目录

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

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

6.测试 nginx 是否正确

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

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

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

返回顶部
顶部