Uncategorized

Changing default port Play Framework

Since version 2.5 you can set the port of your Play application in application.conf but this settings will only be used when running the application in production mode.

play.server {

    # These settings only apply when running in production mode (e.g. when using the stage/dist task)
    # To apply these settings in dev mode see:
    # https://www.playframework.com/documentation/2.5.x/ConfigFile#Using-with-the-run-command
    # https://groups.google.com/d/msg/play-framework/-EE28jmb4Uw/MBRQvAhhCwAJ
    # https://www.playframework.com/documentation/2.5.x/ProductionConfiguration
    # ~~~~~
    http {
        address = 127.0.0.1
        port = 9000
    }

    #https {
    #   address = 127.0.0.1
    #   port = 9000
    #}

}

To set up running on a different PORT apart from 9000, in the development mode, 
In build.sbt add the following line, this would run on 9001 in development mode.
PlayKeys.devSettings := Seq("play.server.http.port" -> "9001")

Leave a Reply

Your email address will not be published. Required fields are marked *