??出現(xiàn)上面標(biāo)題中的問(wèn)題是因?yàn)槲耶?dāng)初在安裝Nginx的時(shí)候沒(méi)有安裝SSL模塊,但是現(xiàn)在我在Nginx配置文件(nginx.cnf)中配置了SSL的相關(guān)配置信息。當(dāng)我再次啟動(dòng)Nginx的時(shí)候就提示我nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:111
了。下面我將我的解決方案給記錄了下來(lái),供大家參考哦!
解決問(wèn)題
首先需要申明一下,我安裝Nginx的目錄是
/usr/local/nginx/
,當(dāng)時(shí)安裝的時(shí)候是通過(guò)源碼安裝的,所以源碼也在這個(gè)目錄下面。接下來(lái)我們會(huì)利用源碼加載 SSL 模塊重新編譯,如果你沒(méi)有源碼則可以選擇重新安裝新版 Nginx 進(jìn)行解決。
先來(lái)看看 Nginx 的版本吧:
[root@xxx ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
...
configure arguments:
可以看到,我這里的configure arguments:
后面沒(méi)有任何配置參數(shù)。
我們現(xiàn)在切換到源碼包目錄下面,增加SSL配置項(xiàng)進(jìn)行重新編譯:
# 切換到Nginx源碼目錄下面:
[root@xxx ~]# cd /usr/local/nginx/
# 新增SSL模塊進(jìn)行重新配置:
[root@xxx nginx]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
# 重新編譯:
[root@xxx nginx]# make
??注意:這里不在需要執(zhí)行make install
命令了,如果執(zhí)行了會(huì)覆蓋之前的安裝,會(huì)有一定的風(fēng)險(xiǎn)哦!
然后備份原有已安裝好的 nginx :
[root@xxx nginx]# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
停止現(xiàn)有的 Nginx 服務(wù):
[root@xxx ~]# /usr/local/nginx/sbin/nginx -s stop
然后將剛剛編譯好的 nginx 覆蓋掉原有的 nginx,剛才重新編譯好的nginx在/usr/local/nginx/objs/
下面。
[root@xxx ~]# cp ./objs/nginx /usr/local/nginx/sbin/
# 執(zhí)行的時(shí)候會(huì)有個(gè)詢問(wèn)過(guò)程,詢問(wèn)你是否選擇覆蓋?此時(shí)輸入 `yes` 然后按`Enter`就行了。
上述執(zhí)行成功后,再執(zhí)行查看 Nginx 版本就可以看到configure arguments:
后面有新的參數(shù)了,如下:
[root@xxx nginx]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
通過(guò)上面控制臺(tái)返回的信息可見(jiàn)新增的SSL模塊成功了。
重新啟動(dòng)Nginx就可以啦:
# 啟動(dòng)Nginx服務(wù)
[root@xxx nginx]# /usr/local/nginx/sbin/nginx
其他
??在Linux系統(tǒng)下安裝 Nginx 服務(wù)及其配置 SSL 證書(shū)實(shí)現(xiàn) HTTPS 訪問(wèn)可以參考下面的文檔哦:
??Centos7安裝Nginx并配置文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-722255.html
??Nginx 配置SSL證書(shū),實(shí)現(xiàn)HTTPS訪問(wèn)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-722255.html
到了這里,關(guān)于Nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!