0

私は同じポートに複数のアプリケーションを持つPhoenix傘プロジェクトを作成しようとしています。私はこのエラーが発生した私の現在の設定で:同じポートにサブドメインを持つPhoenix傘アプリ

⧕ /m/i/d/p/e/portfolio on master * ⟩mix phoenix.server                                 13m 20s 412ms 
==> rumbl 
Compiling 17 files (.ex) 
Generated rumbl app 
[info] Running Rumbl.Endpoint with Cowboy using http://localhost:8080 
[error] Failed to start Ranch listener Persona.Endpoint.HTTP in :ranch_tcp:listen([port: 8080]) for reason :eaddrinuse (address already in use) 

[info] Application persona exited: Persona.start(:normal, []) returned an error: shutdown: failed to start child: Persona.Endpoint 
    ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Server 
     ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, Persona.Endpoint.HTTP} 
      ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup 
       ** (EXIT) {:listen_error, Persona.Endpoint.HTTP, :eaddrinuse} 
** (Mix) Could not start application persona: Persona.start(:normal, []) returned an error: shutdown: failed to start child: Persona.Endpoint 
    ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Server 
     ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, Persona.Endpoint.HTTP} 
      ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup 
       ** (EXIT) {:listen_error, Persona.Endpoint.HTTP, :eaddrinuse} 

私の傘のプロジェクトの詳細については、私は現在、3つのアプリを持っているということです。 1つのアプリは他の2つのアプリにプロキシリクエストを送信します。プロキシアプリは基本的なプラグアプリです。

# /apps/proxy/lib/proxy/plug.ex 
... 
    def call(conn, _opts) do 
    cond do 
     conn.host =~ ~r{rumbl.} -> 
     Rumbl.Endpoint.call(conn, []) 
     true -> 
     Persona.Endpoint.call(conn, []) 
    end 
    end 
... 

ペルソナアプリ

# /apps/persona/config/dev.exs 
... 
config :persona, Persona.Endpoint, 
    http: [port: 8080], 
    debug_errors: true, 
    code_reloader: true, 
    check_origin: false, 
    watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin", 
        cd: Path.expand("../", __DIR__)]] 

...

Rumbl.app

# /apps/rumbl/config/dev.exs 
config :rumbl, Rumbl.Endpoint, 
    http: [port: 8080], 
    debug_errors: true, 
    code_reloader: true, 
    check_origin: false, 
    watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin", 
        cd: Path.expand("../", __DIR__)]] 

私は私の開発と展開のためのnanabox.ioを使用していますので、私の要件があるとそれはすべてhttp/https be received on port 8080が必要です。

答えて

1

プロキシエンドポイントがすべてのトラフィックを受信する場合、ポート2が何かランダムになるようにもう一方のポートを設定して、ポートが衝突しないようにします。

関連する問題