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

时间:2021-04-02 12:53:57   收藏:0   阅读:0

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

重新打包启动即可

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!