nginx:[emerg]unknown directive "ssl"

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

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

 

到解壓的nginx目錄下測試

./configure --with-http_ssl_moduleui

 

當執行上面語句,出現./configure: error: SSL modules require the OpenSSL library.ssl

用 yum -y install openssl openssl-developenssl

再執行./configureit

 

從新執行./configure --with-http_ssl_moduleio

make ,切記不能make install 會覆蓋。test

 

把原來nginx備份require

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

相關文章
相關標籤/搜索