MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. fbr1969
    3. Posts
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    F
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 6
    • Groups 0

    Posts

    Recent Best Controversial
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @ember1205

      Hi,
      With my shortcut “mmirror”, I can access directly to the default Magic Mirror page (define in my MM config.js file), at home (LAN) or at work (by Internet).
      And effectively, I had needed to handle the /socket.io path independently of the of /mmirror path to correct the error I found I my NGinx error log. And that worked like that.
      I’ sorry, but I don’t know how it works exactly…

      posted in Troubleshooting
      F
      fbr1969
    • RE: MagicMirror behind a NGinx Reverse Proxy

      Re: MagicMirror behind a NGinx Reverse Proxy

      I watched my Nginx error file and found :

      2019/12/24 10:20:45 [error] 2341#2341: *1 open() "/var/www/html/socket.io/socket.io.js" failed (2: No such file or directory), client: XX.XXX.XX.XXX, server: mydomain.com, request: "GET /socket.io/socket.io.js HTTP/1.1", host: "mydomain.com", referrer: "https://mydomain.com/mmirror/"```
      

      So, I tried to modify my nginx config file.
      Here’s the final configuration, working fine (don’t forget to change ‘mydomain.com’), and your private IP adress.
      Magic Mirror will be avaiable by : https://mydomain.com/mmirror :

      server {
          listen      80;
          server_name mydomain.com;
          return      301 https://$server_name$request_uri;
      }
      
      server {
      
          # Setup HTTPS certificates
          listen       443 default ssl;
          server_name  mydomain.com;
          ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
          ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
          include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
          ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
      
          # Access to Magic Mirror
          location /mmirror/ {
              proxy_pass              http://192.168.10.60:8080/;
              #proxy_redirect          http://192.168.10.60:8080 /mmirror;
              #proxy_set_header Host $http_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 $scheme;
              proxy_pass_request_headers on;
              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 $scheme;
              proxy_set_header X-Forwarded-Host $http_host;
              proxy_set_header Upgrade $http_upgrade;
              proxy_set_header Connection $http_connection;
              # Disable buffering when the nginx proxy gets very resource heavy upon streaming
              proxy_buffering off;
          }
      
              location /socket.io {
                      # Proxy Magi Mirror Websockets traffic
                      proxy_pass http://192.168.10.60:8080;
                      proxy_http_version 1.1;
                      proxy_set_header Upgrade $http_upgrade;
                      proxy_set_header Connection "upgrade";
                      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 $scheme;
                      proxy_set_header X-Forwarded-Protocol $scheme;
                      proxy_set_header X-Forwarded-Host $http_host;
              }
      
          location / {
              root   /var/www/html;
              index  index.html ;
          }
      }
      
      posted in Troubleshooting
      F
      fbr1969
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @fbr1969
      And yes, Magicmirror is fonctional in direct connection with : http://192.168.10.60:8080

      posted in Troubleshooting
      F
      fbr1969
    • RE: MagicMirror behind a NGinx Reverse Proxy

      @sdetweil @ember1205 Thank for your help.
      I made a mistake ! My error is 404 (Cannot GET /mmirror)

      I forgot to say :

      • My nginx server is fully fonctional with some other locations I’ve masqued in my exemple of configuration files… Like that :
          # Proxy to the Airsonic server
          location /airsonic {
              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;
              proxy_set_header X-Forwarded-Host  $http_host;
              proxy_set_header Host              $http_host;
              proxy_max_temp_file_size           0;
              proxy_pass                         http://192.168.10.30:8080/airsonic;
              proxy_redirect                     http:// https://;
          }
      
          location /calilivre {
              proxy_bind              $server_addr;
              proxy_pass              http://192.168.10.20:8080;
              proxy_set_header        Host            $http_host;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        X-Forwarded-Host $server_name;
              proxy_set_header        X-Scheme        $scheme;
              proxy_set_header        X-Script-Name   /calilivre;  # IMPORTANT: path has NO trailing slash
          }
      
          location /calibd {
              proxy_bind              $server_addr;
              proxy_pass              http://192.168.10.50:8080;
              proxy_set_header        Host            $http_host;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        X-Scheme        $scheme;
              proxy_set_header        X-Script-Name   /calibd;  # IMPORTANT: path has NO trailing slash
          }
      
          location /mmirror {
              proxy_bind              $server_addr;
              proxy_pass              http://192.168.10.60:8080;
              proxy_set_header        Host            $http_host;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        X-Scheme        $scheme;
              proxy_set_header        X-Script-Name   /;  # IMPORTANT: path has NO trailing slash
          }
      

      So, airsonic, calibd or calilivre are fully fonctional in http (redirect to https) or https.
      My 'domainename (ex:domain.com) is resolved by dns.
      I can do my test on my private lan or on Internet. I’ve the same result (502 Bad Gateway).
      Look the curl result :

      curl -iL http://192.168.10.10/mmirror
      HTTP/1.1 301 Moved Permanently
      Server: nginx/1.14.2
      Date: Mon, 23 Dec 2019 18:14:36 GMT
      Content-Type: text/html
      Content-Length: 185
      Connection: keep-alive
      Location: https://[MyDomain]/mmirror
      
      HTTP/1.1 404 Not Found
      Server: nginx/1.14.2
      Date: Mon, 23 Dec 2019 18:14:36 GMT
      Content-Type: text/html; charset=utf-8
      Content-Length: 146
      Connection: keep-alive
      X-DNS-Prefetch-Control: off
      X-Frame-Options: SAMEORIGIN
      Strict-Transport-Security: max-age=15552000; includeSubDomains
      X-Download-Options: noopen
      X-Content-Type-Options: nosniff
      X-XSS-Protection: 1; mode=block
      Content-Security-Policy: default-src 'self'
      
      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="utf-8">
      <title>Error</title>
      </head>
      <body>
      <pre>Cannot GET /mmirror</pre>
      </body>
      </html>
      

      I think I have some problems with some "proxy_set_header " rules.

      Best regards

      posted in Troubleshooting
      F
      fbr1969
    • MagicMirror behind a NGinx Reverse Proxy

      Hi,
      I’m would like to acced to MM (192.168.10.60:8080) behind a Nginx Reverse Proxy (IP:192.168.10.10 for example). I’m not an expert of Nginx and I tried :

      server {
          listen      80;
          server_name domain.com;
          return      301 https://$server_name$request_uri;
      }
      
      server {
      
          # Setup HTTPS certificates
          listen       443 default ssl;
          server_name  domain.com;
          ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
          ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
          include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
          ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
      
          location /mmirror {
              proxy_bind              $server_addr;
              proxy_pass              http://192.168.10.60:8080;
              proxy_set_header        Host            $http_host;
              proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
              proxy_set_header        X-Scheme        $scheme;
              proxy_set_header        X-Script-Name   /;  
          }
          location / {
              root   /var/www/html;
              index  index.html ;
          }
      }
      

      But if y want to access to : 192.168.10.10/mmirror
      I get this error : 502 Bad Gateway nginx/1.14.2
      MagicMirror is of course fully fonctionnal in direct by 192.168.10.60:8080.

      Thank for your help.
      François

      posted in Troubleshooting
      F
      fbr1969
    • 1 / 1