月下博客

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

[root@i z2zedtlk3x091dn4mabwlz sbin]# ./nginx -S quit

nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.conf:94

[root@iz2zedtlk3x091dn4mabwlz sbin]#

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

1.去nginx解压目录下执行

./configure --with-http_ssl_module

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

如果如下报错,执行

[root@i z2zedtlk3x091dn4mabwlz nginx-1.12.2]# cp objs/nginx /usr/local/nginx/ sbin/nginx

cp: overwrite /usr/local/nginx/sbin/nginx'? y

cp: cannot create regular file /usr/local/nginx/sbin/nginx': Text file busy

[root@iz2zedtlk3x091dn4mabwlz nginx-1. 12.2]#

cp -rfp objs/nginx /usr/local/nginx/sbin/nginx

6.测试 nginx 是否正确

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

[root@iz2zedtlk3x091dn4mabwlz sbin]# ./nginx -t

nginx: [emerg] BI0_ new_ file("/usr/local/nginx/ conf/cert/214607884090812.pem" failed (SSL: error : 02001002

f/cert/ 214607884090812. pem', 'r') error: 2006D080:BI0 routines:BI0 new file:no such file)

nginx: configuration file /usr/local/nginx/conf/nginx. conf test failed

[root@iz2zedtlk3x091dn4mabwlz 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@iz2zedtlk3x091dn4mabwlz sbin]#

官方QQ群号码:922069959(空)1093596563(空)

您可能感兴趣的文章