2.配置服務器的證書。操作步驟如下:
[root @ localhost ~]# CD/etc/PKI/TLS/certs
[root @ localhost certs]# make server . key
umask 77
/usr/bin/OpenSSL genrsa-AES 128 2048 & gt;server.key
生成RSA私鑰,2048位長模數
.....................................................
e是61251(0x 10001)
輸入密碼:#設置密碼
驗證-輸入密碼:#確認
#從私鑰中刪除密碼短語
[root @ localhost certs]# OpenSSL RSA-in server . key-out server . key
輸入服務器的密碼。key:#輸入密碼
正在寫入RSA密鑰
[根@本地主機證書]#
[root @ localhost certs]# make server . CSR
umask 77
/usr/bin/OpenSSL req-utf8-new-key server . key-out server . CSR
您將被要求輸入將被合並的信息
到您的證書申請中。
您將要輸入的是所謂的可分辨名稱或DN。
有相當多的字段,但妳可以留壹些空白
對於某些字段,將有壹個默認值,
如果妳輸入“.”,該字段將留空。
-
國家名稱(2個字母的代碼)[XX]:CN #國家
州或省名(全稱)[e]:北京#州
地點名稱(如城市)[默認城市]:北京#城市
組織名稱(如公司)[默認有限公司]:測試#公司
組織單位名稱(如科)[]:測試哈哈#部門
通用名稱(例如,您的服務器的主機名)[]:www . test . com #服務器的FQDN
[]:admin@test.com #電子郵件地址
請輸入以下“額外”屬性
與您的證書申請壹起發送
挑戰密碼[]:# Enter
可選公司名稱[]:# Enter
[根@本地主機證書]#
[root @ localhost certs]# OpenSSL x509-in server . CSR-out server . CRT-req-sign key server . key-days 3650
簽名沒問題
subject =/C = CN/ST =北京/L =北京/O =測試/OU =測試Haha/CN=www.test.com,/emailAddress=admin@test.com
獲取私鑰
[root@localhost certs]# chmod 400服務器。*
3.配置nginx的配置文件。
#服務器{
#聽80;
#服務器名稱happy.cc.com;
#重寫^(.*)$永久;
# }
服務器{
聽80;
監聽443 ssl
服務器名happy.cc.com;
位置/ {
root/data/www/cloud;
索引index.html;
}
ssl打開;
SSL _ certificate/data/web server/nginx/conf/server . CRT;
SSL _ certificate _ key/data/web server/nginx/conf/server . key;
ssl _ session _ timeout 5m
SSL _ protocols SSL v3 tlsv 1;
ssl_ciphers ALL:!ADH:!export 56:RC4+RSA:+高:+中:+低:+SSL v2:+EXP;
ssl _ prefer _ server _ ciphers on
# autoindex on
location = /favicon.ico {
log _ not _ found off
access _ log off
}
位置~。php$ {
root/data/www/cloud;
fastcgi _ pass UNIX:/tmp/PHP-CGI . sock;
# fastcgi _ pass 127 . 0 . 0 . 1:9000;
fastcgi _ index index.php;
fastcgi _ param SCRIPT _ FILENAME/data/www/cloud $ fastcgi _ SCRIPT _ name;
包括fastcgi _ params
}
位置~。*.(gif|jpg|jpeg|png|bmp|swf)$
{
過期30d
}
位置~。*.(js|css)?$
{
過期1h;
}
access _ log/data/log/nginx/happy . access . log訪問;
error _ log/data/log/nginx/happy . error . log warn;
}
4.打開iptables的443端口。