forked from Ikalus1988/MisakaNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson-curl-request-troubleshoot.json
More file actions
16 lines (16 loc) · 1.23 KB
/
Copy pathlesson-curl-request-troubleshoot.json
File metadata and controls
16 lines (16 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"task_id": "lesson-curl-request-troubleshoot",
"title": "curl / wget 请求失败通用排查",
"domain": "devops",
"tags": [
"network",
"curl",
"wget",
"debug",
"troubleshoot"
],
"problem": "`curl https://example.com` 返回空、报错或超时。不知道是 DNS、代理、证书还是目标服务的问题。",
"solution": "```bash\n# 1. DNS 解析\nnslookup example.com\ndig example.com\n# 正常返回 IP 地址 → DNS OK\n# 返回 NXDOMAIN / server can't find → DNS 问题\n\n# 2. 网络连通性(跳过代理)\ncurl -v --noproxy \"*\" https://example.com\n# 能连接但超时 → 防火墙/代理问题\n\n# 3. 证书验证\ncurl -v https://example.com\n# SSL certificate problem → 证书问题\n# 临时跳过(仅测试):\ncurl -k https://example.com\n\n# 4. 代理验证\necho $http_proxy\necho $https_proxy\n# 查看当前代理配置\n\n# 5. 指定超时(默认无超时)\ncurl --connect-timeout 5 --max-time 10 https://example.com\n\n# 6. 只看响应头(不下载内容)\ncurl -I https://example.com\n\n# 7. 完整的排查命令\ncurl -v --trace-ascii /dev/stderr https://example.com 2>&1 | head -30\n```",
"source": "lessons/contrib/curl-request-troubleshoot.md",
"test_cmd": ""
}