惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Latest news
Latest news
T
The Exploit Database - CXSecurity.com
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
L
Lohrmann on Cybersecurity
aimingoo的专栏
aimingoo的专栏
B
Blog
T
Threat Research - Cisco Blogs
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
P
Proofpoint News Feed
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
博客园 - 司徒正美
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
T
Tor Project blog
阮一峰的网络日志
阮一峰的网络日志
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Recorded Future
Recorded Future
D
DataBreaches.Net
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
IT之家
IT之家
B
Blog RSS Feed
Scott Helme
Scott Helme
P
Proofpoint News Feed
V
Vulnerabilities – Threatpost
A
Arctic Wolf
Help Net Security
Help Net Security
L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Vercel News
Vercel News
AWS News Blog
AWS News Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Schneier on Security
Hacker News: Ask HN
Hacker News: Ask HN
N
Netflix TechBlog - Medium
L
LangChain Blog
博客园 - 叶小钗
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
M
MIT News - Artificial intelligence
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
W
WeLiveSecurity

博客园 - longbigfish

部署(https证书) 参数更新 Ubuntu 24安装Neo4j详细教程 protect 紧急 手机 刷脏页的两种模式 python中的多线程陷阱与pytorch分布式执行机制 git之复合指令和submodule rpc编程示例 mpi编程 cifs远程挂载 使用脚本进入一个命令行控制台,并预设执行的命令列表 cifs挂载远程文件出现 No such device or address错误 longtable 跨越多个页面时,如何在跨页时自动断行并加上横线及去掉页眉 matplotlib中文显示-微软雅黑 latex编译过程-关于嵌入所有字体 python做图笔记 linux启动全过程 连接并同步windows下的git仓库 反向ssh
https证书问题(本地)
longbigfish · 2026-04-11 · via 博客园 - longbigfish

服务运行在wsl,本来是在windows宿主机进行了转发将服务端口转发到127.0.0.1,这个地址会自动转发到wsl里面,所有用宿主机ip、wsl地址以为localhost访问都没有问题。

现在要配置https

(1)首先是在wsl中用mkcert创建了key.pem和cert.pem,然后服务启动时读取他,并使用https在监听。

mkcert -key-file key.pem -cert-file cert.pem domain.com 127.0.0.1 117.104.53.25

(2)这时候直接访问是访问不了,特别是chrome会直接不发送信息。

(3)需要在windows下安装证书,具体做法是把wsl中

mkcert -install

安装的rootCA.pem (mkcert -CAROOT会显示路径)拷贝到windows,然后导入到os证书列表。  Win+R → certmgr.msc → 受信任的根证书颁发机构 → 证书 → 右键导入 → 选择桌面上的 rootCA.pem

(4)经过上述一步后,使用wsl地址访问基本没有问题了,chrome可能要删除一下缓存。

地址栏访问:
chrome://net-internals/#hsts t
在 "Delete domain security policies" 里输入 172.21.147.111,点 Delete。

然后访问:
chrome://net-internals/#sockets
点 Flush socket pools。

(5) 但这是用宿主机ip或者localhost可能还是有问题,这应该是端口转发的问题,原来是转发到127本地地址,由这个地址自动转发到wsl里面,但是可能导致了问题。重新设置转发,转发到wsl的地址。就好了。

vite config里是allowedHosts: 'all',

------ powershell 端口映射

查看映射列表:  netsh interface portproxy show all

添加映射:  netsh interface portproxy add v4tov4 listenport=5173 listenaddress=0.0.0.0 connectport=5173 connectaddress=172.21.147.111

将宿主机 5173端口映射到wsl

也可以宿主机创建一个listen port,转发到宿主机本身127.0.0.1比如ss

删除映射 : netsh interface portproxy delete v4tov4 listenport=5173 listenaddress=0.0.0.0

注意:映射时最好两个端口设置不一样,不然后面会端口冲突。