開始Nginx的SSL模塊


nginx: [emerg] the "ssl" parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:37

 

一:開始Nginx的SSL模塊

1.1 Nginx如果未開啟SSL模塊,配置Https時提示錯誤

原因也很簡單,nginx缺少http_ssl_module模塊,編譯安裝的時候帶上--with-http_ssl_module配置就行了,但是現在的情況是我的nginx已經安裝過了,怎么添加模塊,其實也很簡單,往下看: 做個說明:我的nginx的安裝目錄是/usr/local/nginx這個目錄,我的源碼包在/usr/local/src/nginx-1.6.2目錄

1
nginx: [emerg] the  "ssl"  parameter requires ngx_http_ssl_module  in  /usr/local/nginx/conf/nginx.conf:37

1.2 Nginx開啟SSL模塊

切換到源碼包:

1
cd /usr/local/src/nginx-1.11.3

查看nginx原有的模塊

1
/usr/local/nginx/sbin/nginx -V

在configure arguments:后面顯示的原有的configure參數如下:

1
--prefix=/usr/local/nginx --with-http_stub_status_module

那么我們的新配置信息就應該這樣寫:

1
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module

運行上面的命令即可,等配置完

配置完成后,運行命令

1
make

這里不要進行make install,否則就是覆蓋安裝

然后備份原有已安裝好的nginx

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

然后將剛剛編譯好的nginx覆蓋掉原有的nginx(這個時候nginx要停止狀態)

1
cp ./objs/nginx /usr/local/nginx/sbin/

然后啟動nginx,仍可以通過命令查看是否已經加入成功

1
/usr/local/nginx/sbin/nginx -V 

Nginx 配置Http和Https共存

1
2
3
4
5
6
7
8
9
server {
             listen 80  default  backlog=2048;
             listen 443 ssl;
             server_name wosign.com;
             root / var /www/html;
  
             ssl_certificate /usr/local/Tengine/sslcrt/ wosign.com.crt;
             ssl_certificate_key /usr/local/Tengine/sslcrt/ wosign.com .Key;
         }

把ssl on;這行去掉,ssl寫在443端口后面。這樣http和https的鏈接都可以用

Nginx 配置SSL安全證書重啟避免輸入密碼

可以用私鑰來做這件事。生成一個解密的key文件,替代原來key文件。

1
openssl rsa - in  server.key - out  server.key.unsecure

Nginx SSL性能調優

1
2
3
4
5
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES256-SHA384:AES256-SHA256:RC4:HIGH:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!AESGCM;
ssl_prefer_server_ciphers  on ;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;

 

心念一轉,萬念皆轉;心路一通,萬路皆通。
 
分類:  lunx
 
好文要頂  關注我  收藏該文   
2
 
 
 
« 上一篇: openssl生成ssl證書
» 下一篇: Nginx反向代理+負載均衡簡單實現(https方式)
posted @  2017-04-21 16:18 ノGHJ 閱讀(16240) 評論(2) 編輯 收藏
 

 
#1樓   2017-12-20 14:45 kenwar  
感謝樓主的教程,重新配置時./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_modul結尾處少了個‘e’.希望對后面的道友有所幫助
#2樓 [ 樓主] 2017-12-20 14:49 ノGHJ  
@ kenwar
好的
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM