在centos中,配置nginx的https時,出現以下錯誤。html
nginx: [emerg] unknown directive "ssl" in /usr/local/nginx/conf/nginx.conf:102nginx
到解壓的nginx目錄下centos
./configure --with-http_ssl_modulepost
當執行上面語句,出現./configure: error: SSL modules require the OpenSSL library.測試
用 yum -y install openssl openssl-develui
再執行./configurehtm
從新執行./configure --with-http_ssl_moduleblog
make ,切記不能make install 會覆蓋。ssl
把原來nginx備份openssl
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