Go Revel框架端口9000已在使用中

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.

dousui6193
dousui6193 Cha-Ching有效!随时将其发布为答案,我会投票赞成。
接近 7 年之前 回复
dqm7854
dqm7854 为什么不仅仅使用app.conf或revel运行myappdev8888来更改revel应用程序的端口?
接近 7 年之前 回复

4个回答



您可以使用以下任一方法更改revel应用程序的端口:</ p>


  1. 编辑 config / app.conf </ code>文件并设置</ p>

      http.port = 8888 
    </ code> </ pre> < / li>
  2. 使用指定端口的参数运行revel应用程序。 您还需要指定 dev </ code>或 prod </ code>来声明您的环境:</ p>

      revel run myapp dev 8888 \  n </ code> </ pre> </ li> 
    </ ol>
    </ div>

展开原文

原文

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
    



建议使用lsof来检查该端口上是否已在运行该进程:</ p>

 <  code> lsof -i:9000 
</ code> </ pre>

有时,您会发现系统上未安装lsof,然后先安装lsof:</ p>

  sudo apt-get install lsof 
</ code> </ pre>

如果同一应用程序在此端口上运行,则应终止进程并重新启动:</ p>
\ n

  kill -9端口
</ code> </ pre>

如果此端口上正在运行其他进程,则应按照@Vanessa的建议更改默认端口< / p>
</ div>

展开原文

原文

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



您也可以尝试运行</ p>

  ps -A |  grep revel 
</ code> </ pre>

您的revel应用可能仍在运行。 如果是这样,您可以使用</ p>

 杀死PID 
</ code> </ pre>
</ div>杀死它

展开原文

原文

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



您似乎正在运行Nginx / PHP FPM,它将使用端口9000进行FPM进程通信。</ p>

如果Nginx和php安装在同一台计算机上,则可以在PHP-FPM配置中将此更改为其他端口或使用本地套接字(最好)。但是请确保更新Nginx站点 </ p>

对于PHP,请在php-fpm.conf中搜索listen指令:</ p>

 ; 接受FastCGI请求的地址。
; 有效语法为:
; 'ip.add.re.ss:port'-在TCP套接字上侦听
上的特定地址; 特定端口;
; 'port'-在TCP套接字上监听a
上的所有地址; 特定端口;
; '/ path / to / unix / socket'-在Unix套接字上监听。
; 注意:该值是强制性的。
listen = 127.0.0.1:9000
</ pre>

在Nginx中更新fastcgi_pass指令:</ p>

  fastcgi_pass 127.0.0.1:9000;
</ pre>

重新启动Nginx和PHP-FPM,您应该能够再次绑定到端口9000。</ p >
</ div>

展开原文

原文

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.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问