Question

I'm following along with the Go Revel framework nicely until I go to run the test app:

$ revel run myapp

which gives me the all the correct output but also gives the following error:

ERROR 2013/09/30 19:51:41 harness.go:167: Failed to start reverse proxy: listen tcp 
<nil>:9000: address already in use

When I run this:

$ sudo lsof -n -i4TCP:9000 | grep LISTEN

I get this:

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
php-fpm 11007 root   11u  IPv4 0xffffff801441dde0      0t0  TCP localhost:cslistener (LISTEN)
php-fpm 11008 _www    0u  IPv4 0xffffff801441dde0      0t0  TCP localhost:cslistener (LISTEN)
php-fpm 11009 _www    0u  IPv4 0xffffff801441dde0      0t0  TCP localhost:cslistener (LISTEN)
php-fpm 11010 _www    0u  IPv4 0xffffff801441dde0      0t0  TCP localhost:cslistener (LISTEN)

I have a PHP-NGINX app running on port 80 and don't want to lose that but have no idea whether this means this PHP app is blocking my Go app from running.

Can anyone chime in?

I'm running on MacOS X 10.7.5.

Was it helpful?

Solution

You can change the port of a revel application with either:

  1. Editing the config/app.conf file and setting

    http.port = 8888
    
  2. Running your revel application with a parameter specifying the port. You'll also need to specify either dev or prod to state your environment:

    revel run myapp dev 8888
    

OTHER TIPS

It's recommended to check out process is already running on this port by using lsof:

lsof -i :9000

Sometime, you see lsof is not installed on your system then first install lsof:

sudo apt-get install lsof

If same application running on this port, you should kill process and start again:

kill -9 PORT

In case some other process is running on this port then you should change default port as suggested by @Vanessa

You may also try to run

ps -A | grep revel

It is possible that your revel app is still running. If it is, you can kill it with

kill PID

It looks like you're running Nginx / PHP FPM which will use port 9000 for the FPM process communication.

You can change this in your PHP-FPM configuration to either a different port or to use a local socket (preferable) if both Nginx and the php install are on the same machine) but be sure to update your Nginx site definitions to reflect this change as well.

For PHP search your php-fpm.conf for the listen directive:

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses on a
;                            specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000

And in Nginx update the fastcgi_pass directive:

fastcgi_pass   127.0.0.1:9000;

Restart both Nginx and PHP-FPM and you should be able to bind to port 9000 again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top