(轉) nginx 添加http_ssl_module模塊

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

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

 

到解壓的nginx目錄下bash

./configure --with-http_ssl_module測試

 

默認配置路徑是 /usr/local/nginx  若是想要改變路徑 則爲 bash ./configure --prefix=/usr/local/nginx --with-http_gzip_static_module --with-http_ssl_moduleui

 

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

用 yum -y install openssl openssl-develssl

再執行./configureopenssl

 

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

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

 

把原來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

 

若是沒生效的話,關閉nginx:nginx -s stop 重啓nginx

相關文章
相關標籤/搜索