Http Go Revel框架与非本地主机的实时站点
我正在尝试在我的个人网站上运行一个简单的应用程序 当我在本地开发并测试localhost:8888时,一切都正常。但是,在我的web服务器上安装并从root运行我的应用程序后,Http Go Revel框架与非本地主机的实时站点,http,nginx,go,port,revel,Http,Nginx,Go,Port,Revel,我正在尝试在我的个人网站上运行一个简单的应用程序 当我在本地开发并测试localhost:8888时,一切都正常。但是,在我的web服务器上安装并从root运行我的应用程序后,#运行revel personalwebsiteapp我收到以下错误: ERROR 2013/10/01 04:01:35 harness.go:167: Failed to start reverse proxy: listen tcp xx.xxx.xx.xx:80: cannot assign requested a
#运行revel personalwebsiteapp
我收到以下错误:
ERROR 2013/10/01 04:01:35 harness.go:167: Failed to start reverse proxy: listen tcp xx.xxx.xx.xx:80: cannot assign requested address
在这里完全不知所措。我是否需要在Revel上运行代理服务器,如Nginx或其他什么
以下是我的conf/app.conf文件的相关部分:
http.addr="personal-website.com"
http.port=80 #whether I set this to 80 or 8888 doesn't matter, I get the same error
您可能需要以root身份运行(使用
sudo
)来侦听端口80,因为它是一个
对于8888端口,您可能需要修改SELinux规则
比如:
semanage port -a -t http_port_t -p tcp 8888
我可以回答我自己的问题。我最终将我的Revel应用程序路由到Nginx b/c,我永远无法得到@Intermernet关于使用
sudo Revel run
工作的建议
下面是nginx.conf和Revel app.conf文件中的关键细节,以实现此功能
nginx.conf
Go Revel personalwebsiteapp.conf
之后,只需启动Nginx,运行你的revel应用程序和viola!,正在运行。您正在运行什么操作系统?如果是Linux,请尝试使用
sudo
启动应用程序。谢谢您的建议。事实上,我是以root身份运行的,很抱歉没有澄清。我更新了我的问题。但为了完整起见,sudo-run-revel-personalwebsiteapp
由于-bash:revel:command未找到而无法运行。我想使用80端口而不是8888端口,因为外部用户通常会通过personal-website.com
而不是personal-website.com:8888
来查找页面。在这种情况下,我强烈推荐NginX或HAProxy.NginX。NginX似乎没有必要:@timperson没有,但正如我在回答中所说的,这是一个更好的解决方案。“revel:command not found”可能是GOPATH和GOBIN环境变量的问题。感谢您提供有关GOBIN的提示。好的,想知道如何把Revel连接到Nginx。我不是NGINX专家。有没有nginx.conf的演示?这个要点对我不太管用。。。
semanage port -a -t http_port_t -p tcp 8888
server {
listen 80;
# listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html; # not relevant, but gives error if root isn't set to something
index index.html index.htm; # not relevant
# Make site accessible from http://localhost/
# server_name localhost;
server_name my-personal-website.com;
location / {
proxy_pass http://127.0.0.1:9000;
}
}
}
http.addr="127.0.0.1"
http.port=9000