I just migrated from openHAB2 to OH 3. In OH2 I easily could switch the port used by the internal webserver from 8080 to 8081 by editing /etc/default/openhab
This setting was not migrated and editing this file did not help. How can I change the port of openHAB displaying it’s web frontend?
There is an other user who wrote that it would not be possible to change the port using the file /etc/default/openhab.
For me it is working. I change the default port to port 8000 just for test purposes.
Running systemctl status openhab as shown below the status message shows that port 8080 would be used but this is not true as you can see by running netstat which shows that port 8000 is being used:
[19:06:56] root@myopenhabian:/opt/openhabian/functions# systemctl status openhab
● openhab.service - openHAB instance, reachable at http://myopenhabian:8080
Loaded: loaded (/lib/systemd/system/openhab.service; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/openhab.service.d
└─override.conf
Active: active (running) since Wed 2021-01-06 17:31:41 CET; 4 days ago
Docs: https://www.openhab.org/docs/
https://community.openhab.org
Main PID: 7213 (java)
Tasks: 101 (limit: 2318)
Memory: 358.9M
CGroup: /system.slice/openhab.service
└─7213 /usr/bin/java -XX:-UsePerfData -Dopenhab.home=/usr/share/openhab -Dopenhab.conf=/etc/openhab -Dopenhab.runtime=/usr/share/openhab/runtime -Dopenh
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
[19:07:12] root@myopenhabian:/opt/openhabian/functions# netstat -tulpn | grep java
tcp 0 0 127.0.0.1:8101 0.0.0.0:* LISTEN 7213/java
tcp 0 0 127.0.0.1:33933 0.0.0.0:* LISTEN 7213/java
tcp 0 0 0.0.0.0:5007 0.0.0.0:* LISTEN 7213/java
tcp 0 0 0.0.0.0:8443 0.0.0.0:* LISTEN 7213/java
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 7213/java
udp 0 0 0.0.0.0:5353 0.0.0.0:* 7213/java
Also the ps command shows that the changed port is being used:
So I tried to access the Front-End by https:// and 8443. After accepting an insecure certificate it shows me the OH login screen. I do not know if I could also just work with that in future, but I’d rather find a solution to redirect the http-traffic in order to avoid conflicts with another application using 8080.
Maybe you overwrite in openhab-Konfigurations?
Search Files in /var/lib/openhab for Files with 8080 and if not marked out there, try to change there too.
Maybe a different configuration there overwrites the ubuntu configuration from /etc/default/openhab
After the update there now are two files in /etc/default/
openhab2 and openhab
I did not realize the new one without the 2 before. Changed that, restarted service and now I can access the frontend on the desired port also without SSL.