我正在尝试使用Go and the Revel framework在我的live-website.com上运行一个简单的应用。
当我在本地开发并测试localhost时,一切正常:8888。但是,在我的Web服务器上安装并从root运行我的应用程序# run 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
答案 0 :(得分:7)
我可以回答我自己的问题。我最终将我的Revel应用程序路由到Nginx b / c我永远无法得到@ Intermernet建议使用sudo revel run
工作。
以下是nginx.conf和Revel app.conf文件中的关键细节,以使其发挥作用。
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
在此之后,只需启动Nginx,运行你的狂欢应用程序和中提琴!http://my-personal-website.com现在正在运行。
答案 1 :(得分:1)
你可能需要以root身份运行(使用sudo
)来侦听端口80,因为它是Privileged Port。
sudo run revel personalwebsiteapp
对于端口8888,您可能需要修改SELinux规则。
类似的东西:
semanage port -a -t http_port_t -p tcp 8888