By Alvin Alexander. Last updated: April 4, 2018
Play Framework FAQ: How do I set the Play Framework 2.6 port in production mode?
You set the port that your Play Framework application listens on by passing the http.port
parameter to the “run” script for your application:
-Dhttp.port=5150
Here’s an example of a command I use to execute the run script for a Play Framework application named myapp:
myapp-1.0-SNAPSHOT/bin/myapp \ -Dplay.http.secret.key='MY_SECRET_APPLICATION_KEY' \ -Dhttp.port=5150 \ -J-Xms128M \ -J-Xmx512m \ -J-server \ -Dconfig.file=./myapp.conf
This approach passes the http.port setting as a parameter to the Java JVM, i.e., the java
command that’s inside the Play run script.