I’m playing around with my own instance of Lemmy but I keep getting a “websocket connection failed” error in my console. I’m having a really hard time understanding how to set up nginx for websockets - I’m more used to Apache and not familiar with WS at all. Is there documentation hiding somewhere that will help me set up my proxy forwarding properly?

    • aucubin@lemmy.aucubin.de
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 years ago

      Ah, so you added another nginx on the host by installing it from the package store of the distro and have that proxy port 80 to the docker nginx?

      If you do that then you also need to add the websocket settings I had in the first comment to the host nginx.

      What I meant what that the nginx in the docker-compose from lemmy also listens to port 80 and you just need to add

      server {
          listen 80;
          server_name my_domain.tld;
      
          location / {
              proxy_pass http://localhost:LEMMY_PORT;
              proxy_set_header Host $host;
              include proxy_params;
          }
      }
      

      to the nginx.conf of the container.

      Then you should have it accessable from port 80 without the host nginx (of course you need to stop the host nginx then).

      • penguin_ex_machina@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 years ago

        So looking at this again now, am I taking that whole block and adding it to the container’s nginx.conf? If so, does that mean I have to change what port it’s currently listening to (because there’s already a rule in the file for port 80)?

        There’s a comment in that server rule that says “this is the port inside docker” and a comment immediately after that says “this is facing the public web”, which confuses me.