this post was submitted on 11 Jun 2023
6 points (100.0% liked)

Lemmy Support

4651 readers
1 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

I followed the docker installation instructions and added the certificate successfully but I get this status:

400 Bad Request | nginx

host nginx error logs:

2023/06/11 12:12:45 [debug] 10161#10161: *16 http upstream process header
2023/06/11 12:12:45 [error] 10161#10161: *16 connect() failed (111: Connection refused) while connecting to upstream, client: 198.199.109.53, server: mydomain.tld, request: "GET /version HTTP/1.1", upstream: "http://127.0.0.1:82/version", host: "xxx.xxx.xx.xxx"
2023/06/11 12:12:45 [debug] 10161#10161: *16 http next upstream, 2
2023/06/11 12:12:45 [debug] 10161#10161: *16 free rr peer 2 4
2023/06/11 12:12:45 [warn] 10161#10161: *16 upstream server temporarily disabled while connecting to upstream, client: 198.199.109.53, server: mydomain.tld, request: "GET /version HTTP/1.1", upstream: "http://127.0.0.1:82/version", host: "xxx.xxx.xx.xxx"

I replaced my host IP and domain for privacy

Please see my comments below for more info. I tried putting all text here in the body but it won't let me post.

EDIT: It is now fixed! What I did is replace the following line in my host nginx:

location / {
         proxy_pass http://localhost:82;
         proxy_set_header Host $host;  <---- replace this
         include proxy_params;
    }

With this:

location / {
         proxy_pass http://127.0.0.1:82;
         proxy_set_header Connection "keep-alive, Upgrade";
         proxy_set_header Upgrade websocket;
         include proxy_params;
    }

And thanks to @frozen@lemmy.frozeninferno.xyz who pointed me in the right direction to allow search to other instances:

networks:
  # communication to web and clients
  lemmyexternalproxy:
  lemmybridge:  <<----- added this
  # communication between lemmy services
  lemmyinternal:
    driver: bridge
    internal: true

services:
  proxy:
    image: nginx:1-alpine
    networks:
      - lemmyinternal
      - lemmyexternalproxy
      - lemmybridge  <<----- added this

  lemmy:
    image: dessalines/lemmy:0.17.3
    hostname: lemmy
    networks:
      - lemmyinternal
      - lemmybridge <<----- added this
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] ThorfinnOfThors@lemmy.ml 2 points 1 year ago (1 children)

Host nginx.conf

spoiler

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }
}

[โ€“] Jeroen@lemmy.cock.social 1 points 1 year ago

Comment out proxy_set_header Host $host; and sudo systemctl reload nginx.