Page 1 of 1
Https setup of Freematics Hub
Posted: Mon Apr 19, 2021 2:00 pm
by victorch
Hello,
I setup Freematics hub in linux cloud platform running on http(
http://www.serverxxx.com:8080) without problem and that is great. How can I setup Freematics hub(the mini server) to run on https (
https://www.serverxxx.com) - similar to
https://hub.freematics.com ?
Best regards and thanks,
Victor
Re: Https setup of Freematics Hub
Posted: Mon Apr 19, 2021 3:46 pm
by wally2511
This is a good question! I imagine that you are going to have to purchase a ssl cert and configure the webserver to use it.
Sometimes you can generate a self-signed SSL cert and manually install it on the client and server.
Re: Https setup of Freematics Hub
Posted: Mon Apr 19, 2021 5:26 pm
by victorch
Hi Matt,
Yes, I can use self-signed SSL and enable SSL on a Apache web server by using a2enmod ssl etc on a Linux platform. However, I would like to
enable SSL on FreeMatics hub server so that everything sends to this server is secure.
Currently, I can start FreeMatics hub server by ./teleserver -p 8080 or even ./teleserver -p 443, but I believe it is just
port assignment, not SSL enabled in teleserver.c . Do you have idea how to enable SSL in some place
of Freematics-master\server\teleserver, thanks.
Best regards and thanks,
Victor
Re: Https setup of Freematics Hub
Posted: Wed Apr 21, 2021 12:33 am
by victorch
Hi Matt,
I use Nginx and it works, thanks.
Cheers,
Victor
Re: Https setup of Freematics Hub
Posted: Wed Apr 21, 2021 10:20 am
by wally2511
Hey Victor,
This is great new, have you got a walk through or rough guide on how you did it?
Cheers
Matt
Re: Https setup of Freematics Hub
Posted: Wed Apr 21, 2021 1:44 pm
by victorch
Hi Matt,
Please see below some steps for linux platform :
1. sudo apt update
sudo apt install nginx
2. Type below to check version
nginx -v
# Ubuntu repositories
nginx version: nginx/1.1x.0 (Ubuntu)
3. Create self sign certificate for testing
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/private1.key -out /etc/ssl/certs/cert1.crt
4 . In /etc/nginx/sites-available/default file, modify as following :
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
root /var/www/html;
ssl_certificate /etc/ssl/certs/cert1.crt;
ssl_certificate_key /etc/ssl/private/private1.key;
server_name _;
location / {
# forward to 8080
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass "
http://127.0.0.1:8080";
}
5. Restart ngnix
systemctl restart nginx
**Ensure to stop apache if you have apache installed to prevent conflict
6. Run the ./teleserver -p 8080 in linux platform to start Freematics hub server
7. In telelogger , put ip or url e.g.
www.serverxxx.com, port 443, so that traffic will go to Freematics hub server running in 8080 port via
ssl.
Cheers,
Victor