|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
如果您觉得本篇CentOSLinux教程讲得好,请记得点击右边漂浮的分享程序,把好文章分享给你的好朋友们!1.设置nginx办事器
[root@iigconf]#catnginx.conf
worker_processes1;
events{
worker_connections1024;
}
http{
includemime.types;
default_typeapplication/octet-stream;
sendfileon;
keepalive_timeout65;
server{
listen80;
server_namewww.iigrowing.cn;
location/{
rootwww.iigrowing.cn;
indexindex.htmlindex.htm;
}
}
}
2.天生证书
进进证书的目次cd/etc/pki/tls/certs/,创立证书然后设置暗码
makersyslog.key
[root@iigcerts]#opensslrsa-inrsyslog.key-outrsyslog.key
Enterpassphraseforrsyslog.key:
writingRSAkey
[root@iigcerts]#
3.创立证书rsyslog.csr
在创立的时分必要注重要的是要写对盘算机名字,能够用hostname来检察。
[root@iigcerts]#hostname
iig.local.ftp
[root@iigcerts]#makersyslog.csr
umask77;
/usr/bin/opensslreq-utf8-new-keyrsyslog.key-outrsyslog.csr
Youareabouttobeaskedtoenterinformationthatwillbeincorporated
intoyourcertificaterequest.
WhatyouareabouttoenteriswhatiscalledaDistinguishedNameoraDN.
Therearequiteafewfieldsbutyoucanleavesomeblank
Forsomefieldstherewillbeadefaultvalue,
Ifyouenter‘.’,thefieldwillbeleftblank.
—–
CountryName(2lettercode)[GB]:GB
StateorProvinceName(fullname)[Berkshire]:beijing
LocalityName(eg,city)[Newbury]:beijing
OrganizationName(eg,company)[MyCompanyLtd]:www.iigrowing.cn
OrganizationalUnitName(eg,section)[]:iigrowing
CommonName(eg,yournameoryourserver’shostname)[]:iig.local.ftp
EmailAddress[]:
Pleaseenterthefollowing‘extra’attributes
tobesentwithyourcertificaterequest
Achallengepassword[]:
Anoptionalcompanyname[]:
4.天生证书机构用于发表公钥
由于我们是在当地天生的没有在互联网CA证书机构发表证书,因而在会见的时分会弹出扫瞄器告诫,我们增加到证手札任机构就能够了。
[root@iigcerts]#
[root@iigcerts]#opensslx509-inrsyslog.csr-req-signkeyrsyslog.key-days365-outrsyslog.crt
Signatureok
subject=/C=GB/ST=beijing/L=beijing/O=www.iigrowing.cn/OU=iigrowing/CN=iig.local.ftp
GettingPrivatekey
[root@iigcerts]#
5.修正nginx设置文件
修正设置文件,必要注重的是我们把默许的ssl模块复制到我们创立的假造目次内里便可,默许的不要翻开,然后修正路径便可。如图是完成的设置。记得重启办事。
worker_processes1;
events{
worker_connections1024;
}
http{
includemime.types;
default_typeapplication/octet-stream;
sendfileon;
keepalive_timeout65;
server{
listen80;
server_namewww.iigrowing.cn;
location/{
rootwww.iigrowing.cn;
indexindex.htmlindex.htm;
}
}
server{
listen443;
server_namewww.iigrowing.cn;
sslon;
ssl_certificate/etc/pki/tls/certs/rsyslog.crt;
ssl_certificate_key/etc/pki/tls/certs/rsyslog.key;
ssl_session_timeout5m;
ssl_protocolsSSLv2SSLv3TLSv1;
ssl_ciphersALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_cipherson;
location/{
rootwww.iigrowing.cn;
indexindex.htmlindex.htm;
}
}
}
6.测试https协定
在以下目次,创立a.txt文件,内容以下图
翻开扫瞄器,输出以下地点:https://www.iigrowing.cn/a.txt
显现了局
欢迎大家来到仓酷云论坛! |
|