Question

I'm trying to use Go and the Revel framework to run a simple app on my live, personal-website.com.

Everything is ok when I develop locally and test localhost:8888. However after installing on my web server and running my app from root, # run revel personalwebsiteapp I get the following error:

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

At a total loss here. Do I need to run a proxy server like Nginx or something on top of Revel?

Here's what could be a relevant part of my conf/app.conf file:

http.addr="personal-website.com"
http.port=80 #whether I set this to 80 or 8888 doesn't matter, I get the same error
Was it helpful?

Solution

I can answer my own question. I ended up routing my Revel app to Nginx b/c I could never get @Intermernet's suggestion of using sudo revel run to work.

Below are the key details from the nginx.conf and Revel app.conf files to make this work.

nginx.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;
                }
        }

}

Go Revel personalwebsiteapp app.conf

http.addr="127.0.0.1"
http.port=9000

After this, just start up Nginx, run your revel app and viola!, http://my-personal-website.com is now live.

OTHER TIPS

You probably need to run as root (use sudo) to listen on port 80 as it's a Privileged Port.

sudo run revel personalwebsiteapp

For port 8888, you may need to modify the SELinux rules.

Something like:

semanage port -a -t http_port_t -p tcp 8888
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top