Go web部署报错panic: listen tcp xxxxxxx:8090: bind: cannot assign requested address

1.centos部署go环境

vim /etc/profile

export PATH=$PATH:/usr/local/go/bin
export GOROOT=/usr/local/go #go包的解压目录
export GOPATH=/opt/GOPATH #表示实际的工作目录
export PATH=$GOPATH/bin/:$PATH

source /etc/profile

2.打包go build main.go

3.后台启动nohup ./main &> web.log

4.查看web.log发现报错

panic: listen tcp ip:8090: bind: cannot assign requested address

5.解决

修改web服务启动ip地址为 0.0.0.0

重新打包启动即可

上一篇:python接口自动化37-模拟ajax异步请求(X-Requested-With:XMLHttpRequest)


下一篇:踩坑Git上传代码到gitee报 The requested URL returned error: 403