this post was submitted on 13 Jul 2023
12 points (87.5% liked)

Selfhosted

37924 readers
538 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
 

This is a slow learning process for me and some of you already helped me a lot to figure out reverse proxies in general. However, I'm not there yet ... so:

How can I set up Lemmy (and Mastodon down the line) behind my existing reverse proxy? I'm trying to install from docker and the docker compose files come with templates for reverse proxy configuration, but these are (probably) only valid, if I'm installing on a dedicated server with nothing else running there.

I tried commenting out the stuff for the proxy configuration, but I can't seem to get it to work. The Lemmy install ends up with 5 docker containers (lemmy, lemmy-ui, ....) and I'm not sure which of them need to be adressed by my proxxy setup. Just getting the lemmy-ui container addressed by nginx didn't work out.

I'm probably way out of my league with what I'm trying here, but if any of you have some useful tips I'd be really grateful.

you are viewing a single comment's thread
view the rest of the comments
[–] matt@lemmy.piperservers.net 2 points 1 year ago (1 children)

Think of the NGINX proxy in Lemmy's docker-compose.yml file as the entry point to Lemmy from outside the Docker network. For instance, I don't have any ports mapped for the individual services except for the NGINX service. The NGINX proxy in this docker-compose file will access the other services through the internal docker network, so it isn't a problem if you set up your nginx.conf file with the service's names. With that done, you could map any port you want for the NGINX service from the host, then point your internet-facing reverse proxy to that.

I also plan on setting up a Mastodon server, but I haven't gotten to it yet. So I don't have anything specific to add other than it will work similarly by using docker's port mapping or service names depending on whether each service needs to be internet-facing or only communicate internally.

[–] Solvena@lemmy.world 1 points 1 year ago (1 children)

In the configuration of the docker proxxy, do I define my domain name (like lemmy.my-domain.tld) or will I define some local IP (like 172.20.0.1) and let nginx proxy manager point to that?

[–] matt@lemmy.piperservers.net 1 points 1 year ago* (last edited 1 year ago) (1 children)

You can use the FQDN of your Lemmy instance in the nginx.conf file. I've uploaded my files to a gist here as an example.

You should be able just to replace any mention of lemmy.mydomain.com with your FQDN of your Lemmy instance and replace any your-postgres-password with your real Postgres password. You must also set your SMTP provider settings in the email section of config.hjson (I use Brevo). In the docker-compose.yml file, you can change which port you want to map from the host; I used 8976 in mine. Then just point your internet-facing reverse proxy to the host and whichever port you chose.

I'm not using Ansible to automate it at all. I'm just updating the files manually, as needed, and doing docker compose commands. I'm using Docker volumes to persist the data on them, so feel free to change any of those basic things you want.

[–] Solvena@lemmy.world 1 points 1 year ago

thanx! I got it running now, not sure yet if federation is working, but at least I have my instance up and could register admin + standard user :)