显示标签为“Go”的博文。显示所有博文
显示标签为“Go”的博文。显示所有博文

2017年10月23日星期一

GoProxy的PHP模式部署到Heroku平台教程

方法一
1. Heroku部署php go的git方法教程:
a. 注册一个Heroku账号: https://signup.heroku.com/signup/dc
b. 安装:Heroku toolbelt部署工具包: https://devcenter.heroku.com/articles/getting-started-with-python#set-up
c. 下载后提取里面的index.go文件 :https://github.com/phuslu/goproxy/archive/server.php-go.zip
d. 打开CMD窗口依次运行下面的命令:
heroku login
输入注册邮箱
输入账号密码
登录成功:Authentication successful.
接着运行下面的命令:
git clone https://github.com/freeformz/go-heroku-example
cd go-heroku-example
进入go-heroku-example目录,删除web.go,然后把前面下载的index.go放进去
回到CMD窗口,运行下面的命令
heroku create
创建一个app,并记住app的名称
接着运行下面的命令:
git add -A
git commit -am "make it better"
git push heroku master
测试一下,在浏览器输入:app名称.herokuapp.com,如果返回以下信息,表示部署成功:
Application Error
An error occurred in the application and your page could not be served. Please try again in a few moments.
然后把php网址:http://app名称.herokuapp.com,填入php.json里面,并在httpproxy.json把php移到最前面,运行goproxy
Heroku通过git部署php go服务端到此完成!