2026/4/18 13:19:55
网站建设
项目流程
网站推广总结,在线公司取名,网站质量需求,全国网站建设公3分钟搞定本地HTTPS#xff01;mkcert零配置开发证书终极指南 【免费下载链接】mkcert A simple zero-config tool to make locally trusted development certificates with any names youd like. 项目地址: https://gitcode.com/GitHub_Trending/mk/mkcert
还在为本地…3分钟搞定本地HTTPSmkcert零配置开发证书终极指南【免费下载链接】mkcertA simple zero-config tool to make locally trusted development certificates with any names youd like.项目地址: https://gitcode.com/GitHub_Trending/mk/mkcert还在为本地开发环境的HTTPS证书问题头疼吗浏览器安全警告、复杂的CA配置、跨平台兼容性差……这些痛点今天一次解决mkcert让本地HTTPS变得如此简单连配置文件都不需要为什么你需要mkcert传统方案有多痛苦自签名证书浏览器疯狂警告 ❌自建CA命令复杂难懂 公共CA测试域名申请流程繁琐 ⏳mkcert有多香⚡️ 3分钟完成安装配置 支持所有主流浏览器 跨平台兼容Windows/macOS/Linux 本地安全隔离无滥用风险快速开始3步搞定本地HTTPS第1步安装mkcertmacOS用户brew install mkcert brew install nss # 如果使用FirefoxLinux用户# 先安装依赖 sudo apt install libnss3-tools # 再安装mkcert brew install mkcertWindows用户# 使用Chocolatey choco install mkcert # 或使用Scoop scoop bucket add extras scoop install mkcert第2步安装本地CA安装完成后只需要一条命令mkcert -install看到这些输出就成功了Created a new local CA The local CA is now installed in the system trust store! ⚡️ The local CA is now installed in the Firefox trust store (requires browser restart)! 第3步创建你的第一个证书# 为开发环境创建证书 mkcert example.com localhost 127.0.0.1 ::1输出示例Created a new certificate valid for the following names - example.com - localhost - 127.0.0.1 - ::1 The certificate is at ./example.com4.pem and the key at ./example.com4-key.pem ✅常用场景速查手册 基础用法# 单域名证书 mkcert example.com # 通配符证书 mkcert *.example.com # 多域名/IP证书最常用 mkcert example.test localhost 127.0.0.1 # 输出文件example.test2.pem 和 example.test2-key.pem 高级功能ECC算法证书更小更快mkcert -ecdsa example.com客户端证书mkcert -client client.example.comPKCS#12格式Java/Windowsmkcert -pkcs12 example.com # 输出example.com.p12密码changeit自定义输出路径mkcert -cert-file cert.pem -key-file key.pem example.com服务器配置示例Nginx配置server { listen 443 ssl; server_name example.test localhost; ssl_certificate /path/to/example.test2.pem; ssl_certificate_key /path/to/example.test2-key.pem; }Node.js配置const https require(https); const fs require(fs); const options { key: fs.readFileSync(example.test2-key.pem), cert: fs.readFileSync(example.test2.pem) }; https.createServer(options, app).listen(443);常见问题与解决方案❓ 浏览器仍然显示安全警告解决方法重启浏览器特别是Firefox检查证书主题是否匹配清除SSL状态缓存❓ Node.js环境不信任证书解决方法export NODE_EXTRA_CA_CERTS$(mkcert -CAROOT)/rootCA.pem❓ 多环境管理使用CAROOT环境变量# 开发环境 export CAROOT~/mkcert-dev mkcert -install # 测试环境 export CAROOT~/mkcert-test mkcert -install安全提醒 ⚠️永远不要分享rootCA-key.pem文件生产环境禁用mkcert证书定期检查证书有效期立即行动现在就开始使用mkcert告别本地HTTPS配置的烦恼今日任务清单✅ 安装mkcert✅ 运行mkcert -install✅ 为你的项目创建证书✅ 配置开发服务器使用HTTPS你的本地开发体验从此大不相同【免费下载链接】mkcertA simple zero-config tool to make locally trusted development certificates with any names youd like.项目地址: https://gitcode.com/GitHub_Trending/mk/mkcert创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考