laravel 项目安装 https 证书失败:The client lacks sufficient authorization :: Invalid response from

文章目录

    用旧的方法给 Laravel 项目安装 certbot https 证书报错:

    sudo certbot --nginx
    
    Failed authorization procedure. xxx.sunzhongwei.com (http-01): urn:ietf:params:acme:error:unauthorized :: The client lacks sufficient authorization :: Invalid response from http://xxx.sunzhongwei.com/.well-known/acme-challenge/xxx  "<!DOCTYPE html>\n<html>\n    <head>\n        <meta name=\"robots\" content=\"noindex,nofollow\" />\n        <style>\n            /* Copyr"
    

    从报错看,应该是要建立一个临时的目录文件,来验证网站归属。

    而 Laravel 的资源跟目录是 public,所以指定参数之后,证书安装成功。

    sudo certbot certonly --webroot -w /home/user_name/laravel_project_name/public -d xxx.sunzhongwei.com
    
    Saving debug log to /var/log/letsencrypt/letsencrypt.log
    Plugins selected: Authenticator webroot, Installer None
    Obtaining a new certificate
    
    IMPORTANT NOTES:
     - Congratulations! Your certificate and chain have been saved at:
       /etc/letsencrypt/live/xxx.sunzhongwei.com/fullchain.pem
       Your key file has been saved at:
       /etc/letsencrypt/live/xxx.sunzhongwei.com/privkey.pem
       Your cert will expire on 2019-12-06. To obtain a new or tweaked
       version of this certificate in the future, simply run certbot
       again. To non-interactively renew *all* of your certificates, run
       "certbot renew"
    

    再安装之前的方法将 nginx 的配置修改即可。

    关于作者 🌱

    我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊,或者关注我的个人公众号“大象工具”, 查看更多联系方式