Continuation from: https://lemm.ee/post/10351499 (I think that's the right thing to do rather than necroing an old thread)

I've been following the directions in https://join-lemmy.org/docs/administration/from_scratch.html and I'm hoping to get some help debugging my nginx config files.

It seems that the instructions for configuring nginx have some bugs.

curl https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/main/templates/nginx.conf \
    --output /etc/nginx/sites-enabled/lemmy.conf
# put your actual domain instead of example.com
sed -i -e 's/{{domain}}/example.com/g' /etc/nginx/sites-enabled/lemmy.conf
sed -i -e 's/{{lemmy_port}}/8536/g' /etc/nginx/sites-enabled/lemmy.conf
sed -i -e 's/{{lemmy_ui_port}}/1234/g' /etc/nginx/sites-enabled/lemmy.conf
nginx -s reload

I was pointed at a thread which suggests using something similar to the ansible configuration https://github.com/LemmyNet/lemmy-ansible/pull/90/files

but I haven't been able to get that working either. Whenever I try to connect I get an error page and the logs are full of:

127.0.0.1 - - [18/Oct/2023:19:53:51 +0000] "GET /api/v3/site? HTTP/1.0" 500 170 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"

and

2023/10/18 18:48:08 [alert] 73064#73064: *321837 768 worker_connections are not enough while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /api/v3/site? HTTP/1.0", upstream: "http://127.0.0.1:8536/api/v3/site?", host: "44.205.105.157"

I found some other threads that suggest this is a problem with a loop in nginx.

These are my config files:
/etc/nginx/nginx.conf: https://pastebin.com/aN78drum
/etc/nginx/sites_enabled/lemmy.conf: https://pastebin.com/ZGywujAB
/etc/nginx/sites_enabled/lemmy_internal.conf: https://pastebin.com/5AXbvmPx

I think I remembered to comment all the changes I made.

lemmy and lemmy-ui resolve to 127.0.0.1 in localhost

mydomain.com is a dummy I own the actual domain and it's pointed at an elastic IP that's associated with the ec2 instance. Everything is on that ec2 instance.