I know that I can start a rails server on another port via -p option. But I\'d like to setup another port per application as long as I start webrick.
An
You can launch WEBrick like so:
rails server -p 8080
Where 8080 is your port. If you like, you can throw this in a bash script for convenience.
You could install $ gem install foreman, and use foreman to start your production webserver (e.g. unicorn) as defined in your Procfile like so: $ foreman run web. If unicorn is your web server you can specify the port in your unicorn config file (as with most server choices). The benefit of this approach is not only can you set the port in the config, but you're using an environment which is closer to production.