久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

nginx 配置https

 lanyue211 2014-03-17

nginx 配置https

同事測(cè)試一ssl加密接口,,但是負(fù)責(zé)該接口的同事有事請(qǐng)假了沒在,,所以我就臨時(shí)給配置了一個(gè)https服務(wù),寫了一個(gè)簡單接口供同事使用,,配置nginx的https記錄一下:

一,、生成私鑰和證書

創(chuàng)建帶密鑰口令的私鑰
root@mysqlmaster:/tmp# openssl genrsa -des3 -out ng.key 1024
Generating RSA private key, 1024 bit long modulus
........++++++
...........................................++++++
e is 65537 (0x10001)
Enter pass phrase for ng.key: 輸入口令
Verifying - Enter pass phrase for ng.key: 確認(rèn)口令
二、創(chuàng)建csr文件
root@mysqlmaster:/tmp# openssl req -new -key ng.key -out ng.csr
Enter pass phrase for ng.key:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:國家 如cn,,hk
State or Province Name (full name) [Some-State]:州或省的名稱 如Beijing
Locality Name (eg, city) []:什么地方級(jí)別,,是城市還是鄉(xiāng)鎮(zhèn)
Organization Name (eg, company) [Internet Widgits Pty Ltd]:什么組織,如公司,,政府
Organizational Unit Name (eg, section) []:組織單位名稱
Common Name (eg, YOUR name) []:名字
Email Address []:郵件地址

Please enter the following 'extra' attributes 額外信息
to be sent with your certificate request
A challenge password []: 復(fù)雜密碼
An optional company name []:

1,,創(chuàng)建私鑰(去除密鑰口令)
openssl rsa -in ng.key -out server.key
輸入口令

2,創(chuàng)建CA證書
openssl req -new -x509 -days 3650 -key server.key -out server.crt
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:
Email Address []:
和上面的步驟差不多,,根據(jù)提示輸入證書的信息,,國家,管理人郵件,,姓名,,城市等


三、修改nginx配置文件

root@mysqlmaster:/tmp# cp server.crt server.key /etc/nginx/
默認(rèn)需要證書放到nginx/conf/目錄,,那么
vi /etc/nginx/nginx.conf

增加

server{
listen 443;
server_name localhost;
ssl on;
ssl_certificate server.crt; #證書
ssl_certificate_key server.key; #私鑰
location / {
root html;
index index.html index.htm;
}
}
root@mysqlmaster:/tmp# service nginx restart
重啟服務(wù)

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式,、誘導(dǎo)購買等信息,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多