2

Hi, does anybody have an idea what the reason could be? I installed a lemmy instance on a VPS using the docker images. Beforehand I installed nginx and got a letsencrypt - certificate (which seems to have worked). I downloaded the nginx.conf file from github and made the configurations, also in the lemmy.config and docker-compose.yml files. However, I'm unsure if there's anything else I should look at. Any tips are welcome :)

top 5 comments
sorted by: hot top controversial new old
[-] slashzero@hakbox.social 4 points 1 year ago* (last edited 1 year ago)

Hi there!

TL;DR: probably have an nginx misconfiguration. Check the nginx logs for errors.


You don’t need to install and run nginx on the host. It has its own container in the docker-compose.yml which gets started up on docker-compose up -d

If both instances of nginx are trying to bind to the same port, one will start and one will fail.

Is the lemmy proxy nginx docker container running? Check with: docker ps or docker container ls. If the lemmy nginx proxy container isn’t running, try stopping the host instance of nginx (systemctl nginx stop) and restart docker lemmy (docker-compose down, docker-compose up -d), the try to access your site again.

[-] Solvena@lemmy.world 0 points 1 year ago

that seems to have been part of the problem, as I indeed had nginx running on the host as well. Now I get the error code "website cannot be reached" when I try to go to my instance in the browser.

I tried to follow the configuration for nginx as was in the template file on github, but I most probably have an error there. One thing confuses me, that's the ports for lemmy and the lemmy UI. I think they should be 8536 an 1235 respectively, but sometimes it says 1234 and 1236 for the UI port as well. Also in the template I'm using (https://github.com/LemmyNet/lemmy-ansible/blob/main/templates/nginx.conf#L63) there is only one section to enter ports: proxy_pass http://0.0.0.0:{{lemmy_port}}; - which port do I enter here?

if you happen to know, please let me know :)

[-] footty@lemmy.world 1 points 1 year ago

That is a conf for the host system nginx, in which you enter the lemmy port defined on the left side of your proxy service's port section.

...
ports:
      # actual and only port facing any connection from outside
      # Note, change the left number if port 1236 is already in use on your system
      # You could use port 80 if you won't use a reverse proxy
      - "{{ lemmy_port }}:8536"
[-] NeonWoofGenesis@kek.henlo.fi 2 points 1 year ago

As @slashzero@hakbox.social said, if you're using an additional nginx server, your docker nginx can't listen for port 80 or 443. Here's my host nginx reverse proxy's ssl section for reference:

server {
    server_name kek.henlo.fi;

        location / {
	proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        include proxy_params;
        proxy_pass http://localhost:9001;
    }

    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    ssl_certificate /etc/letsencrypt/live/kek.henlo.fi/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/kek.henlo.fi/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
}

Maybe you're missing some proxy headers, or the docker compose isn't forwarding the correct ports.

But it can definitely be something completely different.

[-] erre@feddit.win 1 points 1 year ago

I'm pretty sure that error indicates nginx isn't receiving a response from the upstream server (Lemmy and Lemmy-UI). So, either your upstream server isn't responding to requests or nginx is misconfigured with the wrong upstream server 🤔

load more comments
view more: next ›
this post was submitted on 02 Jul 2023
2 points (62.5% liked)

Selfhosted

39677 readers
403 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS