In openHAB 1.7 the start scripts could be modified to change the port number for the service, however in 2.0 this is not true. Jetty runs only on 8080 and/or 8443. Should this be filed as a bug?
hmm … as far as i can see the
start.bat both contain the according variables to configure another port.
Thanks for your response. Yes they do but changing them does not effect anything. The jetty server still runs on port 8080.
that has been a problem (see https://github.com/openhab/openhab2/issues/84) but should be fixed long ago. Are you sure you are running the latest oh2 version?
Hello again, Yes I believe I do have the updated version. I picked it up from the cloundbees site on August 14th and your commit was from Feb 13th
since the demo-server is running on 9080 i am quite sure that changing the port worked (at least for oh2a2 release). Which OS are you running?
@teichsta I am running this on Windows 10 with JAVA 1.8.0_51 and openHAB runtime is v2.0.0, build 201508080141.
I can access openHAB only on port 8080
which doesn’t seem to be the recent version (see https://github.com/openhab/openhab2/blob/master/distribution/openhabhome/start.bat). Frankly i didn’t try the Win version. Can anybody of the Win-Users confirm that this bat file isn’t working properly?
@teichsta Just downloaded the latest snapshot from cloudbees - openHAB runtimev2.0.0, build 201509021732. Still seeing the same behaviour.
ports under 1024 are restricted ports, though I am not sure how Windows respects that. Have you tried running OpenHAB with elevated privs under windows (ie as administrator) ?
I’m the author of PR 332 which allows you to set the HTTP and HTTPS ports without needing to change the start.bat scripts.
You should just need to set an environment variable OPENHAB_HTTP_PORT to, say, 4711, to make OH2 run on a port different to the standard 8080.
Having said that, I have tested this change only on my Linux setup. Also, the comment with “ports under 1024” holds true on Windows as well. If you really need OH2 to run on port 80, you should configure a reverse proxy for that.
@xsnrg and @hakan Yes to the fact that ports under 1024 are restricted but I have successfully tested running openHAB on port 80 under version 1.7.0 and 1.7.1 by simply changing the start.bat (and start_debug.bat) files. The environment variable was not set in either case. Here is a break down of the use cases I have tried:
- Edit startup.bat to change ports - Works with 1.7.x and NOT with 2.0 (no elevated privileges needed)
- Add environment variable OPENHAB_HTTP_PORT and set it to 80 (no changes to startup scripts) - DOES NOT WORK FOR 1.7.x & 2.0
- Run as a service - same as 1.
This is true on windows 8.1 and WIndows 10 - both 64 bit versions.
-Dorg.osgi.service.http.port=$HTTP_PORT \ -Dorg.osgi.service.http.port.secure=$HTTPS_PORT \
-Djetty.port=%HTTP_PORT% ^ -Djetty.port.ssl=%HTTPS_PORT% ^
I would assume this is a bug in the bat file. @mganapa, could you please try if replacing jetty.port by org.osgi.service.http.port solves the problem?
@Kai Thanks! That did the trick. Never thought of comparing the .sh file with the .bat. Works as expected now.
Great, thanks for the feedback!
I have fixed this now: https://github.com/openhab/openhab2/commit/849c938d71d9d2726a54b148e12438f5d46417b3
Now that OH2 is using karaf, i think to change the port, you need to change it in
or can these still be set in start.sh/cmd
@Kai -Ah cool - i had not seen any of the documentation under here. It answers many many questions i had so thanks for linking to it!
Yes, it is important to note that https://github.com/openhab/openhab-distro is the new “entry point” for openHAB 2 - the repo https://github.com/openhab/openhab2-addons now only contains add-ons (as its new name suggests).
@kai I’m using the latest beta snapshot and have set the environment arguments but openhab2 is still starting on port 8080 instead of 80.
I’m using openhab2 on the rpi maybe it’s because of the rpi