Debian 10 apache2配置https

apache2配置https

首先需要证书,可以看我另一篇关于openssl颁发证书的blog

配置https

#编辑配置文件
vim /etc/apache2/site-avaiable/default-ssl.conf
#修改32-33行,修改为自己存放证书的位置
 SSLCertificateFile      /ssl/skills.crt
 SSLCertificateKeyFile /ssl/skills.key
#修改52行
#修改这个是因为使用终端curl请求https站点不显示安全警告信息
SSLCACertificateFile /ssl/cacert.crt
#然后使用Apache的命令使得ssl生效
root@Server01:~# a2ensite default-ssl.conf
Enabling site default-ssl.
To activate the new configuration, you need to run:
  systemctl reload apache2
root@Server01:~# systemctl reload apache2
root@Server01:~# a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
  systemctl restart apache2
#最后重启服务
systemctl srestart apache2

配置使用http访问时自动跳转https

#编辑配置文件
root@Server04:~# vim /etc/apache2/sites-available/000-default.conf
#注释12行的默认页位置,因为也用不上http了,直接注释即可
#在12行下方新添加一行跳转链接
#DocumentRoot /var/www/html
redirect permanent "/" "https://www.skills.com"
#最后重启服务
systemctl restart apache2

浏览器访问https站点不提示安全警告

#直接在浏览器中找到设置,直接搜索证书,打开证书查看,点击导入,把openssl的根证书导入即可
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

cc_pwd

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值