How to specify the port number for a server?

I have a number of sites in my dev environment now, each starting under CommandBox with Server Start [servername] and i get a home page for that server something like “http://127.0.0.1:36745

But every once in a while there’s a hiccup somewhere and next time i start the machine, and start the server it starts ok but with a different port. How do i control what port is used? I assume it’s using a .json file but which one? and is there any documentation about what can go in there and if so, how?

If it makes a difference, the Lucee is v5.3.9.141
commandBox is v5.5.2+00578

Cheers
Mike Kear
Windsor, NSW, Australia

Hi, you can define the port in the starting commandline or within your server.json

See: https://commandbox.ortusbooks.com/embedded-server/configuring-your-server/server-port-and-host

About setting server.json see:
https://commandbox.ortusbooks.com/embedded-server/server.json

I think you can define various server.json in your webroot (e.g. one for dev and another for prod) and call them differently with the starting commandline, but I’m not an expert with that.

2 Likes

Holy Cr*p!!! there’s a lot more you can do with server.json than i thought. I was looking for documentation about that but couldn’t find it on the CommandBox site. Thank you so much!!
Cheers
Mike Kear
Windsor, NSW, Australia

1 Like

@mikek you are more than welcome!

my bookmark for this stuff is this one :slight_smile:

2 Likes