Help Building Lemmy [part 3/???]

Continuation from: 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 join-lemmy.org/docs/…/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.


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

I was pointed at a thread which suggests using something similar to the ansible configuration 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:


<span style="color:#323232;">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)"
</span>

and


<span style="color:#323232;">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"
</span>

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: pastebin.com/aN78drum
/etc/nginx/sites_enabled/lemmy.conf: pastebin.com/ZGywujAB
/etc/nginx/sites_enabled/lemmy_internal.conf: 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.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • lemmy_support@lemmy.ml
  • localhost
  • All magazines
  • 200 @ entry_single
    HTTP status 200 OK
    Route name entry_single
    Has session yes
    Stateless Check no
    Time 2955 ms
    Total time 2955 ms
    Initialization time 475 ms
    Memory 12.0 MiB
    Peak memory usage 12.0 MiB
    PHP memory limit 128 MiB
    Cache 1
    Number of forms 1
    Number of errors 0
    Logger 93
    Errors 0
    Warnings 0
    Deprecations 93
    Cache 68 in 824.70 ms
    Cache Calls 68
    Total time 824.70 ms
    Cache hits 31 / 65 (47.69%)
    Cache writes 23
    640
    Default locale en
    Missing messages 640
    Fallback messages 0
    Defined messages 148
    Security n/a
    Authenticated No
    Firewall name main
    Twig 1074 ms
    Render Time 1074 ms
    Template Calls 88
    Block Calls 83
    Macro Calls 6
    54 in 813 ms
    settings_row_switch 15
    user_avatar 12
    user_settings_row_switch 4
    date 3
    user_inline 2
    settings_row_enum 2
    entry 1
    date_edited 1
    vote 1
    boost 1
    entries_cross 1
    editor_toolbar 1
    user_actions 1
    magazine_box 1
    magazine_sub 1
    related_magazines 1
    active_users 1
    related_categories 1
    related_posts 1
    related_entries 1
    support_us_block 1
    featured_magazines 1
    22 in 263.87 ms
    Database Queries 22
    Different statements 15
    Query time 263.87 ms
    Invalid entities 0
    Cache hits 27
    Cache misses 8
    Cache puts 8
    6.4.0
    Profiler token 82d6b0
    Environment dev
    Debug enabled
    PHP version 8.2.26   View phpinfo()
    PHP Extensions Xdebug ✗ APCu ✓ OPcache ✓
    PHP SAPI apache2handler