http修改为https.(zabbix为例)

背景:http 不够安全 修改为https更加安全。
原理:通过加密生成 ssl 证书,然后 指定证书路径和对应应用的位置,即可通过 https 访问

1.http > https

安装 openssl 和生成密匙和证书

安装 openssl

yum install mod_ssl openssl

生成证书

下面的英文解释

》openssl genrsa -out server.key 2048
2.生成证书签名请求
》openssl req -new -key server.key -out server.csr
 
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.
您将要输入的内容称为可分辨名称或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]:CN
国家名称(2字母代码)[XX]:CN
State or Province Name (full name) []:xxx
州或省名称(全名)[]:xxx
Locality Name (eg, city) [Default City]:xxx
地点名称(例如,城市)[默认城市]:xxx
Organization Name (eg, company) [Default Company Ltd]:test.com
组织名称(例如,公司)[默认有限公司]:测试。通用域名格式
Organizational Unit Name (eg, section) []:test   
组织单位名称(例如,部门)[]:测试
Common Name (eg, your name or your server's hostname) []:test.com
公用名(例如,您的姓名或服务器的主机名)[]:测试。通用域名格式
Email Address []:test@xx.com
 电子邮件地址[]:test@xx.com
Please enter the following 'extra' attributes
to be sent with your certificate request
随您的证书申请一起发送
A challenge password []:123456
挑战密码[]:123456
An optional company name []:test
可选公司名称[]:测试

3.指定密匙 生成的证书为 10 年
openssl x509 -req -days 36500 -in server.csr -signkey server.key -out server.crt

其他博客的图,只有密码要记住的 其他的随便填 能通过就行。
在这里插入图片描述

配置Apache服务

vim /etc/httpd/conf.d/ssl.conf
1.修改下面的内容
在这里插入图片描述

SSLCertificateFile /etc/pki/CA/server.crt
SSLCertificateKeyFile /etc/pki/CA/server.key

2.重启Apache httpd
#重启https 服务
/etc/init.d/httpd restart
或者
systemctl restart httpd.service

#查看状态
systemctl status httpd.service

3.开启 443 端口

开放443端口:
firewall-cmd --zone=public --add-port=443/tcp --permanent
重启服务:
systemctl restart firewalld.service
显示服务的状态:
systemctl status firewalld.service

成功页面
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值