- Server operating system version
- Ubuntu 20.04.6 LTS
- Plesk version and microupdate number
- Plesk Obsidian 18.0.52
Hi,
I'm trying to make openhab cloud (GitHub - openhab/openhab-cloud: Cloud companion for openHAB instances) work on Plesk but it seems impossible for me.
To explain briefly how it should work:
- Local openhab instance connects with UUID and secret to openhab cloud instancen. They are connected via websocket
(seems to work since local instance is shown as online)
- User calls OPENHAB.mydomain.com (where openhab cloud is running) and logs in
- Application shows a link to HOME.mydomain.com, which get proxied to the dashboard of the local instance (I my case it does not work)
This is the additional directive for openhab.mydomain.com
And this the additional directive for home.mydomain.com
I get "502 Bad Gateway" with this.
ChatGPT told me that I should consolidate those directives to something like this
How can I do something like this in Plesk?
Best regards
I'm trying to make openhab cloud (GitHub - openhab/openhab-cloud: Cloud companion for openHAB instances) work on Plesk but it seems impossible for me.
To explain briefly how it should work:
- Local openhab instance connects with UUID and secret to openhab cloud instancen. They are connected via websocket
(seems to work since local instance is shown as online)
- User calls OPENHAB.mydomain.com (where openhab cloud is running) and logs in
- Application shows a link to HOME.mydomain.com, which get proxied to the dashboard of the local instance (I my case it does not work)
This is the additional directive for openhab.mydomain.com
NGINX:
location /css {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/css;
}
location /js {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/js;
}
location /img {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/img;
}
location /bootstrap {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/bootstrap;
}
location /font-icons {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/font-icons;
}
location /fonts {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/fonts;
}
location /js-plugin {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/js-plugin;
}
location /staff/js-plugin {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/js-plugin;
}
location /downloads {
alias /var/www/vhosts/mydomain.com/oh.mydomain.com/public/downloads;
}
location ~ /.well-known {
allow all;
}
location ~ ^/(socket.io|rest|images|static|rrdchart.png|chart|openhab.app|WebApp|CMD|cometVisu|proxy|greent|jquery|classicui|ui|basicui|doc|start|icon|habmin|remote|habpanel|ifttt/v1/actions/command) {
proxy_pass http://SERVER-IP:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location / {
proxy_pass http://SERVER-IP:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
And this the additional directive for home.mydomain.com
NGINX:
location / {
proxy_pass http://SERVER-IP:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
I get "502 Bad Gateway" with this.
ChatGPT told me that I should consolidate those directives to something like this
NGINX:
server {
listen 80;
listen [::]:80;
server_name myopenhab.org www.myopenhab.org home.myopenhab.org;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name myopenhab.org www.myopenhab.org home.myopenhab.org;
charset utf-8;
access_log /var/log/nginx/my.openhab.org-access.log;
error_log /var/log/nginx/my.openhab.org-error.log;
client_max_body_size 300m;
root /var/www/html;
location ~ /.well-known {
allow all;
}
location ~ ^/(socket.io|rest|images|static|rrdchart.png|chart|openhab.app|WebApp|CMD|cometVisu|proxy|greent|jquery|classicui|ui|basicui|doc|start|icon|habmin|remote|habpanel|ifttt/v1/actions/command) {
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location / {
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}
How can I do something like this in Plesk?
Best regards