3

recently i have created a new ec2 instances (quick launch ) and i tried to deploy my Play! application the security group gives access to port 80 and port 22 (SSH) but when i run :

play start 80

it gives me this

[error] org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:80
[error] Use 'last' for the full log.

which means that the 80 port is used when i run

netstat -tlnp 

i get

    Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      3692/sendmail       
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      3653/sshd           
tcp        0      0 :::22                       :::*                        LISTEN      3653/sshd 

i've searched all the web but i didn't figure it out, help me please !

NOTE : i just solve this all i have to do is start it with sudo.

  • 1
    Are you trying to start the Play! application as root (i.e. with sudo)? You need superuser privileges to bind to ports below 1024. Also, the second line of the error says to 'use last for the full log'. What is displayed in the 'full log'? – cyberx86 Feb 11 '13 at 01:23
  • i just figured out, i'm dumb actually i just have to run with sudo. thank you! – Daoud JAHDOU Feb 11 '13 at 01:23

2 Answers2

2

Since you're binding to a port below 1024, it must be started with root privileges.

Try something like:

sudo play start 80
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
2

To deploy on EC2 you should create a standalone version of your application in your local machine using:

play dist

Then you copy the generated .zip to your EC2 instance using scp, unzip it using unzip.

You would then want to run your application like so:

sudo nohup yourAppName-version/bin/yourAppName -Dhttp.port=80

sudo in order to be able to bind to a port below 1024.

nohup in order to be able to exit the ssh session without sending the HUP signal to your play app.

yourAppName-version/bin/yourAppName replaced with YOUR app's name & version should be where your script is.

-Dhttp.port is the option to bind to a given port.


Additional Info: You should consider adding -J-Xms128M -J-Xmx512m to avoid RAM allocation problems (I use micro instances, adjust to your needs).