宝塔配置完SSL之后访问显示403 forbidden问题解决

Posted 但老师

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了宝塔配置完SSL之后访问显示403 forbidden问题解决相关的知识,希望对你有一定的参考价值。

文章目录

1. 宝塔配置好SSL

背景

  • 域名购买于腾讯云
  • SSL是申请的免费证书
  • 服务器购买于腾讯云但不在我名下

配置SSL证书

保姆级配置过程见腾讯云宝塔轻量服务器Linux如何开启SSL证书


2. 访问显示403

假设我的域名是hot.aisa,配置完我在浏览器输入https://www.hot.asia,结果返回了大大的
403 Forbidden

3. 解决问题

经查, 原来是配置文件夹下没有对应的目录文件

  • 在宝塔配置中可以看到是需要有默认的目录文件的
  • 访问实际文件夹,发现没有这些文件
  • 那就创建一个
    vim index.html
    
    直接导入Python之禅
    The Zen of Python, by Tim Peters<br>
    <br>
    Beautiful is better than ugly.<br>
    Explicit is better than implicit.<br>
    Simple is better than complex.<br>
    Complex is better than complicated.<br>
    Flat is better than nested.<br>
    Sparse is better than dense.<br>
    Readability counts.<br>
    Special cases aren't special enough to break the rules.<br>
    Although practicality beats purity.<br>
    Errors should never pass silently.<br>
    Unless explicitly silenced.<br>
    In the face of ambiguity, refuse the temptation to guess.<br>
    There should be one-- and preferably only one --obvious way to do it.<br>
    Although that way may not be obvious at first unless you're Dutch.<br>
    Now is better than never.<br>
    Although never is often better than *right* now.<br>
    If the implementation is hard to explain, it's a bad idea.<br>
    If the implementation is easy to explain, it may be a good idea.<br>
    Namespaces are one honking great idea -- let's do more of those!
    
    保存退出

4. 访问成功!

再次在浏览器输入https://www.hot.asia,显示Python之禅!

结论

原来是nginx没有找到对应的目录文件,随便创建一个放进去就好了!

以上是关于宝塔配置完SSL之后访问显示403 forbidden问题解决的主要内容,如果未能解决你的问题,请参考以下文章

宝塔ssl部署完,https无法访问故障解决

宝塔面板如何部署启用ssl证书?

windows server 2003 iis配置 出现 http 403 禁止访问,怎么办,网页内显示“你无权查看该网页”

403forbidden404not found宝塔 nginx配置默认首页nginx demo

网页中的外部资源在线提供 403,但在本地工作。有没有办法解决?

为啥更换ssl证书后http访问不了网站?