让服务器通过 MobaXterm 反向连接到笔记本的 7897 端口。
测试服务器端口
bash
Get-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" | Select-Object ProxyEnable, ProxyServer
显示为:
c
ProxyEnable ProxyServer
----------- -----------
1 127.0.0.1:7897
MobaXterm 本地终端写入:
bash
ssh -o ServerAliveInterval=30 -o ExitOnForwardFailure=yes -R 7890:127.0.0.1:7897 r@192.168.10.xxx
liunx服务器写入命令:
bash
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
export ALL_PROXY="http://127.0.0.1:7890"
测试:
bash
curl -I https://api.openai.com --connect-timeout 15
curl -I https://chatgpt.com --connect-timeout 15
c
只要不再出现:
Failed to connect to 127.0.0.1 port 7890
就说明服务器已经能通过笔记本的代理出网了。
然后启动 Codex
bash
cd /home/r/work/codex_test
bash
codex --sandbox workspace-write --ask-for-approval on-request