this post was submitted on 18 Jun 2023
0 points (50.0% liked)

Lemmy Support

4654 readers
22 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

ETA: This is being done on a Raspberry Pi 4 running 64-bit Raspbian using an external SSD as storage.

I am following the instructions here: https://github.com/LemmyNet/lemmy-docs/blob/4249465e9960cad97245aa03b3ad4c758ff945c7/src/en/administration/install_docker.md

Please note that I have only used docker a few times in the past and have always failed so that could be a contributing factor.

My goal for the moment is just to have the instance on localhost so I can play around with it before deciding if running my own instance is something I have the time for.

Here are the steps I have taken so far and the result:

`WARNING: The Qa variable is not set. Defaulting to a blank string. WARNING: The k variable is not set. Defaulting to a blank string. ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable. `

I imagine I'm doing a lot of things wrong. I would be extremely appreciative for any help anybody can provide.

you are viewing a single comment's thread
view the rest of the comments
[–] animist@lemmy.one 1 points 1 year ago* (last edited 1 year ago)

Okay so here are the contents of the nginx.conf file:

worker_processes 1;
events {
    worker_connections 1024;
}
http {
upstream lemmy {
    # this needs to map to the lemmy (server) docker service hostname
    server "lemmy:8536";
}
upstream lemmy-ui {
    # this needs to map to the lemmy-ui docker service hostname
    server "lemmy-ui:1234";
}

server {
    # this is the port inside docker, not the public one yet
    listen 80;
    # change if needed, this is facing the public web
    server_name localhost;
    server_tokens off;

    gzip on;
    gzip_types text/css application/javascript image/svg+xml;
    gzip_vary on;

    # Upload limit, relevant for pictrs
    client_max_body_size 20M;

    add_header X-Frame-Options SAMEORIGIN;
    add_header X-Content-Type-Options nosniff;
    add_header X-XSS-Protection "1; mode=block";

    # frontend general requests
    location / {
        # distinguish between ui requests and backend
        # don't change lemmy-ui or lemmy here, they refer to the upstream definitions on top
        set $proxpass "http://lemmy-ui";

        if ($http_accept = "application/activity+json") {
          set $proxpass "http://lemmy";
        }
        if ($http_accept = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"") {
          set $proxpass "http://lemmy";
        }
        if ($request_method = POST) {
          set $proxpass "http://lemmy";
        }
        proxy_pass $proxpass;

        rewrite ^(.+)/+$ $1 permanent;
        # Send actual client IP upstream
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    # backend
    location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
        proxy_pass "http://lemmy";
        # proxy common stuff
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Send actual client IP upstream
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

}