快速检索
host not found in upstream
问题描述
使用nginx 进行反向代理的时候,配置 proxy_pass 时使用域名,Nginx 提示
host not found in upstream
原因分析
DNS解析域名失败,ping一下域名发现ping不通
解决方案
使用Switchhosts配置域名服务器或者直接将proxy_pass配置为ip地址
nginx: [error] OpenEvent
问题描述
在重启nginx时,使用
nginx -s reload
提示
OpenEvent("Global\ngx_reload_22492") failed (2: The system cannot find the file specified)
原因分析
此时nginx并没有启动,因此没有重载到文件
解决方案
首先可以尝试关闭nginx(在nginx目录下)
.\nginx.exe -s quit
如果依然提示OpenEvent failed
那就直接启动nginx,执行
.\nginx.exe start nginx
location =/ { #alias html/agentAccount/dist/login.html; proxy_pass http://172.30.5.101:8083/login.html;
}
nginx启动成功 报500错误
问题描述
nginx启动后 但是服务并没有启动 浏览器报500错误
原因分析
由于我自己用师姐的nginx.conf文件替换了自己的,所以在配置文件里的proxy_pass配置的还是师姐的ip地址
location =/ {
#alias html/login.html;
proxy_pass http://172.30.5.101:8083/login.html;
}
解决方案
将ip地址换为自己的ip就OK了
在控制台输入ipconfig即可查看自己的ip地址
PS C:\WINDOWS\system32> ipconfig
Windows IP 配置
以太网适配器 以太网:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . :
IPv4 地址 . . . . . . . . . . . . : (这里就是你的Ip地址)
子网掩码 . . . . . . . . . . . . :
默认网关. . . . . . . . . . . . . :
以太网适配器 VirtualBox Host-Only Network:
连接特定的 DNS 后缀 . . . . . . . :
本地链接 IPv6 地址. . . . . . . . :
IPv4 地址 . . . . . . . . . . . . :
子网掩码 . . . . . . . . . . . . : 255.255.255.0
默认网关. . . . . . . . . . . . . :