1. 程式人生 > >nginx:[emerg]unknown directive "ssl"

nginx:[emerg]unknown directive "ssl"

在centos中,配置nginx的https時,出現如下錯誤。

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

到解壓的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 會覆蓋。

把原來nginx備份

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

把新的nginx覆蓋舊的

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

出現錯誤時cp: cannot create regular file ‘/usr/local/nginx/sbin/nginx’: Text file busy

用cp -rfp objs/nginx /usr/local/nginx/sbin/nginx解決

測試nginx是否正確

/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)

重啟nginx

/usr/local/nginx/sbin/nginx -s reload