彻底使用 Docker 开发 PHP 项目 (四): CLI

系列文章

CLI

为方便操做,我封装了一些命令。php

Linux/macOS

$ ./lnmp-docker.sh

Windows 10

请在 PowerShell 中执行,禁止执行脚本的问题请查看系列一的文章。nginx

$ ./lnmp-docker.ps1

CLI 功能

下面内容以 ./lnmp-docker.sh 为例,Windows 10 用户自行替换为 ./lnmp-docker.ps1docker

自签名 SSL 证书(支持通配符)

$ ./lnmp-docker.sh ssl-self khs1994.com *.khs1994.com 127.0.0.1 192.168.199.100 localhost

生成的文件位于 ./config/nginx/ssl-self浏览器

浏览器不信任自签名 CA 证书,请自行将 root-ca.crt 导入浏览器。(方法自行查找)bash

生成 NGINX 配置

假设 PHP 项目位于 ./app/my_php_projectapp

$ ./lnmp-docker.sh nginx-config https my_php_project demo.khs1994.com

打开 ./config/nginx/demo.khs1994.com.conf 检查配置,确保正确以后,从新启动rest

$ ./lnmp-docker.sh restart nginx

127.0.0.1 demo.khs1994.com 写入 /etc/hosts日志

浏览器打开 https://demo.khs1994.com 验证。(请确保浏览器导入了 root-ca.crtcode

清理日志文件

$ ./lnmp-docker.sh cleanup

更多功能

执行 ./lnmp-docker.sh 自行探索ssl

相关文章
相关标签/搜索