How to have two Yunohosts servers at home?

My second device is a phone. It gets proxied through the YunoHost to the internet.

Solution:

  1. Register a domain and install a Lets-Encrypt certificate for the domain on the YnoHost server:

     yunohost domain add proxy.domain.tld 
     yunohost domain cert-install proxy.domain.tld
    
  2. Go to the /etc/nginx/conf.d/proxy.domain.tld.d and create a file proxy.conf. Add the following code with your own second server ip:

     location /  {
      proxy_pass https://192.168.0.100;  #ip address of the other server(needs to be static)
      proxy_set_header Host $host;
      
      #Force https
      if ($scheme = http) {
         rewrite ^ https://$server_name$request_uri? permanent;
          }
    
      proxy_buffering off;
      tcp_nodelay on;
    
     }
    
  3. Restart the nginx:

    service nginx restart

Note:- You will have to login to the YunoHost page to get the access to the proxy page. If you need to bypass it, add the proxy.domain.tld to the skipped_urls under /etc/ssowat/conf.json.persistent .

"skipped_urls": [
  "proxy.domain.tld"
]
1 Like