欧美性猛交xxx嘿人猛交_又色又爽又高潮免费观看_精品国产一区二区三区久久影院_青娱乐极品视觉盛宴国产视频

技術頻道導航
HTML/CSS
.NET技術
IIS技術
PHP技術
Js/JQuery
Photoshop
Fireworks
服務器技術
操作系統
網站運營

贊助商

分類目錄

贊助商

最新文章

搜索

使用OpenSSL為Nginx配置HTTPS證書

作者:admin    時間:2017-4-5 12:3:17    瀏覽:

OpenSSL官方推薦win32可執行文件版下載:

 OpenSSL

一、證書制作

1、制作CA證書:

ca.key CA私鑰:

openssl genrsa -des3 -out ca.key 2048

制作解密后的CA私鑰(一般無此必要):

openssl rsa -in ca.key -out ca_decrypted.key

ca.crt CA根證書(公鑰):

openssl req -new -x509 -days 7305 -key ca.key -out ca.crt

2、制作生成網站的證書并用CA簽名認證

在這里,假設網站域名為www.cuckooft.com

生成www.cuckooft.com證書私鑰:

openssl genrsa -des3 -out www.cuckooft.com.pem 1024

制作解密后的www.cuckooft.com證書私鑰:

openssl rsa -in www.cuckooft.com.pem -out www.cuckooft.com.key

生成簽名請求:

openssl req -new -key www.cuckooft.com.pem -out www.cuckooft.com.csr

在common name中填入網站域名,如www.cuckooft.com即可生成改站點的證書,同時也可以使用泛域名如*.webkaka.com來生成所有二級域名可用的網站證書。

用CA進行簽名:

openssl ca -policy policy_anything -days 1460 -cert ca.crt -keyfile ca.key -in www.cuckooft.com.csr -out www.cuckooft.com.crt

其中,policy參數允許簽名的CA和網站證書可以有不同的國家、地名等信息,days參數則是簽名時限。

如果在執行簽名命令時,出現“I am unable to access the ../../CA/newcerts directory

修改 /etc/pki/tls/openssl.cnf 中“dir = ./CA

然后:

mkdir -p CA/newcerts

touch CA/index.txt

touch CA/serial

echo "01" > CA/serial

再重新執行簽名命令。

最后,把ca.crt的內容粘貼到www.cuckooft.com.crt后面。這個比較重要!因為不這樣做,可能會有某些瀏覽器不支持。

好了,現在https需要到的網站私鑰www.cuckooft.com.key和網站證書www.cuckooft.com.crt都準備完畢。接下來開始配置服務端。

二、配置Nginx服務器

新開一個虛擬主機,并在server{}段中設置:

listen 443;

ssl on;

ssl_certificate /path/to/www.cuckooft.com.crt;

ssl_certificate_key /path/to/www.cuckooft.com.key;

其中的路徑是剛剛生成的網站證書的路徑。

然后使用一下命令檢測配置和重新加載nginx:

    檢測配置:

nginx -t

    重新加載:

nginx -s reload

三、優化nginx配置

1、優化nginx性能

http{}中加入:

ssl_session_cache shared:SSL:10m;

ssl_session_timeout 10m;

據官方文檔所述,cache中的1m可以存放4000個session。

在配置https的虛擬主機server{}中加入:

keepalive_timeout 70;

2、有時在phpMyAdmin等程序登入后會錯誤地跳轉http的問題。

解決方法是定位至 “location ~ .*\.(php|php5)?${}” 在include fcgi.conf;或者在fastcgi_param配置后面加上:

fastcgi_param HTTPS on;

fastcgi_param HTTP_SCHEME https;

在這里是nginx官方的關于https的文檔:

 https文檔

可以作為參考。

=====================================

本文文章來源是:http://blog.creke.net/762.html,經網友測試證實方法可用,有疑問可到博主網頁上交流。如下為部分網友的反饋。

 

 

=====================================

您可能對以下文章也感興趣

標簽: nginx  https  linux技術  
x