Another thank for you, Peter
Now I just wonder a question, hope you can answer: for example I am owning a domain: https://www.abc.com
Then in the configuration of the file /etc/nginx/sites-enabled/default:
I am also very much a noob in this field, but mine also works and looks very similar to what Moxified posted. Except that I do not have a domain name. I do have a static IP though, and that is what I put as a “server_name”. Just the IP, no http://, https:// or anything, just the ip, like this:
I use a VPN. This solution works well for me because I sometimes want SSH access to the Pi to change configurations or look at log files. It also allows me to access other devices on my LAN (network cameras, etc.). The quick access is not an issue for me since it’s usually faster to activate my VPN on my phone than to wait for myopenhab to respond. It’s also more reliable.
I also use a VPN on demand connection, i.e. if I open openHAB app on my i-phone, the VPN connection is automatically build-up. Consequently I have no open ports in my router.
I tried to describe it here:
@Extrabannies Woah really good reference, thanks
But after reading your post, it seems that fritzbox router is a must to proceed so-called VPN-on-demand service right?
Has anyone ever tried setting up VPN on raspberry pi to get access remotely to OH2? Please show me how
No, in principle it does work with any VPN connection.
Just use the file provide under the heading “Clientkonfiguration auf dem iPhone”, adopt the parameters acc. to your VPN set-up, send via e-mail to yourself and implement it on your i-phone.
This is correct, I’ve just completed the setup. See Cloud setup. Also talks about what you need to do to send notifications through your own cloud. I also need to add details about editing, Mail.js (not 100%sure on the name, but, that’s close), to take mail out of development mode.
You can get account on any free cloud MQTT Broker (like cloudMQTT for example). Then you use OpenHAB MQTT Binding to make Openhab connect to this broker and exchange topics. You can use SSL/TLS security. And finally some MQTT client on your Android/iOS device will connect to the same broker. This is not a Web-based solution though, but extremely fast and you don’t need to open any ports on your system
There are many methods to do this - the difference is security, easiness of the configuration and cost of the solution.
Following I am typing some methods with some analyses
1. Port Forwarding (with Dynamic DNS and SSL encryption)
This requires router configuration (to forward your routers public port to OH2 private port), however this requires you to have fixed ip address. In case your ip address is not fixed (in most cases) you need to use Dynamic DNS services to be able to use domains instead ip address (there are available free services i.e. https://www.noip.com/free ). Here we still have security question open. To solve security question i.e. setup ssl certificate we can use Let’s Encrypt service ( https://letsencrypt.org/ ) to get free certificate, however we should configure OH2 server to use the certificate or we should setup reverse proxy (in most cases nginx or apache) and configure proxy to use certificate.
Conclusion – Hard to setup if we want to have secure connection (can be done for free)
For this scenario we should use VPN services. We should connect our OH2 server to VPN then in other side we should connect our client to VPN (i.e. mobile device) that will allow us to access to OH2 by local IP address. We can set up our own VPN server (i.e. https://openvpn.net/ ) however this requires knowledge to do it right.
Conclusion – Easy, Paid, Secure, Bad User Experience (connecting to VPN every time you need to connect to OH2)
For this scenario we can use free tunneling services (i.e. https://tunnelin.com/ ). The process is very straight forward i.e. Register a User, Connect your device to service (by running one line command on device), use Web interface to open/close secure tunnels to the device.
I recently set up an IPSec VPN to access OH from my Android, mainly due to recurring issues with myopenhab.
The VPN tunnel works fine and is fast. But the Android App always tries to connect to myopenhab.og when I’m not connected to a Wifi. Is there a way to force the app to use the “internal” IP even with 4G?