gpt4 book ai didi

php - 如何在 Ubuntu 18.10 上使用 Laravel Homestead 设置 HTTPS

转载 作者:太空宇宙 更新时间:2023-11-03 15:12:06 27 4
gpt4 key购买 nike

我正在使用 Laravel Homestead 开发一个项目,该项目需要 SSL 证书才能使用 HTTPS。我所有的同事都使用 Mac OS,但我是唯一一个使用 Ubuntu (ubuntu 18.10) 的人。

如何在 Ubuntu 上为 Laravel Homestead 设置 HTTPS?

最佳答案

由于 Homestead 只是一个以 Nginx 作为默认网络服务器的 Vagrant 虚拟机,您可以选择使用 Let's Encrypt certificateself signed certificate .

我会从这 2 个选项中推荐一个自签名证书,因为您的域可能没有指向您的开发机器,并且您必须至少每 3 个月手动执行一次 DNS-01 质询。

我自己创建自签名证书的较短方法是:

  1. 创建一个名为 v3.ext

    的文件
    authorityKeyIdentifier=keyid,issuer
    basicConstraints=CA:FALSE
    keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
    subjectAltName = @alt_names
    [alt_names]
    DNS.1 = *.example.com
    DNS.2 = *.example2.com
  2. openssl genrsa -des3 -out rootCA.key 2048

  3. openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem

  4. openssl req -new -nodes -out server.csr -newkey rsa:2048 -keyout server.key

  5. openssl x509 -req -in server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out server.crt -days 3650 -sha256 -extfile v3.ext

关于php - 如何在 Ubuntu 18.10 上使用 Laravel Homestead 设置 HTTPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56186597/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com