Nginx 配置校验
诚实说明:浏览器不能替你测你服务器的 nginx 配置。这个工具生成正确的
nginx -t测试命令 + 常见错误对照表,复制到你的服务器执行,得到真实校验结果。不做「点击即测」假承诺。
生成测试命令
输入配置路径,生成测试与转储命令。
常见错误对照表
| 报错 | 原因 | 处置 |
|---|---|---|
unknown directive |
指令拼错 / 模块未加载 | 查拼写;nginx -V 看编译参数是否含该模块 |
directive is not allowed here |
指令放错上下文 | http / server / location 层级搞错,挪到正确块 |
host not found in upstream |
upstream 域名解析失败 | dig 确认域名;直接用 IP 或修 DNS |
emerg bind() failed |
端口被占用 | ss -tlnp \| grep :80 找占用者 |
conflicting server name |
server_name 重复 | 两个 server 块同名,合并或改名 |
"upstream" directive is not allowed here |
upstream 放错块 | upstream 必须在 http 层,不能进 server |
相关教程
- Nginx 反向代理 502/504 排查 — 配置改挂后的排障