基于https的加密网站(https+ssl)

基于https的加密网站(https+ssl)

SSL协议位于TCP/IP协议与各种应用层协议之间,为数据通讯提供安全支持。SSL协议可分为两层: SSL记录协议(SSL Record
Protocol):它建立在可靠的传输协议(如TCP)之上,为高层协议提供数据封装、压缩、加密等基本功能的支持。 SSL握手协议(SSL
Handshake
Protocol):它建立在SSL记录协议之上,用于在实际的数据传输开始前,通讯双方进行身份认证、协商加密算法、交换加密密钥等

HTTPS服务一般是通过SSL(安全套接字层)来保证安全性的,端口号为:443

1.安装make指令

[root@qq ~]# dnf install make -y 

2.创建密匙

[root@qq ~]# cd /etc/pki/tls/certs
[root@qq certs]# make xixi.crt 
[root@qq certs]# make xixi.crt
umask 77 ; \
/usr/bin/openssl genrsa -aes128 2048 > xixi.key
Generating RSA private key, 2048 bit long modulus (2 primes)
................................................................................
..................+++++
...........+++++
e is 65537 (0x010001)
Enter pass phrase:
Verifying - Enter pass phrase:
umask 77 ; \
/usr/bin/openssl req -utf8 -new -key haha.key -x509 -days 365 -out xixi.crt
Enter pass phrase for haha.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) [XX]:86
State or Province Name (full name) []:chongqing
Locality Name (eg, city) [Default City]:yongchuan
Organization Name (eg, company) [Default Company Ltd]:123
Organizational Unit Name (eg, section) []:jiasuanji
Common Name (eg, your name or your server's hostname) []:web.baidu.com
Email Address []:admin@qq.com

3.移动密匙到默认路径

[root@qq certs]# mv xixi.key /etc/pki/tls/private/xixi.key 

4.进入httpd服务的配置文件写配置

[root@qq ~]# cd /etc/httpd/conf.d
[root@qq conf.d]# vim host.conf

在virtualhost标签内加入如下几段

SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/xixi.crt
SSLCertificateKeyFile /etc/pki/tls/private/xixi.key

重启服务

[root@qq conf.d]# systemctl restart httpd
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值