this post was submitted on 07 Jul 2023
39 points (93.3% liked)

Selfhosted

40041 readers
613 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
 

I have Mastodon running on a VPS running Debian 11. Now I would like to add a Lemmy instance on the same server. I tried using the from scratch method from Lemmy documentation, but ran into errors that likely stemmed from minor version incompatibilities of the dependencies. I tried using the Lemmy easy deploy script but it wants to bind all traffic on port 443 for Lemmy which would break my Mastodon install. Has anyone managed to get Lemmy and Mastodon running on the same box, and if so, can you share any details of your setup?

you are viewing a single comment's thread
view the rest of the comments
[–] immibis@social.immibis.com 6 points 1 year ago* (last edited 1 year ago) (3 children)

@TrinityTek@lemmy.world @selfhosted@lemmy.world Everything on your server has a URL, like https://your.server.name.example/c/your_community_name. Unless you want all the official public URLs to everything on your server to have a port number in them (https://your.server.name.example:1234/TrinityTek) you probably want to figure this out before deploying anything.

I suggest using vhosts. You can for example run Lemmy on port 8001 and Mastodon on port 8002 (both should be bound to 127.0.0.1 without HTTPS). Then you get two domain names pointing at the same server. Then you install nginx on your server, as your actual web server, and you configure it so requests for lemmy.trinitytek.com gets proxied to lemmy and mastodon.trinitytek.com gets proxied to mastodon

[–] Stubborn9867@lemmy.jnks.xyz 3 points 1 year ago

I found it easiest to get them running on docker. The documentation wasn't FANTASTIC, but it got me there in the end.

Then I have nginx proxy manager running in another docker container, which handles the virtual hosts for me. It's the one actually bound to 80 and 443. Will help you get set up with SSL certs easily, too.

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

Thanks for the advice. I'm actually very experienced with vhosts, but my understanding was that vhosts are an Apache thing and Nginx uses different terminology. Unfortunately I am still very green when it comes to Nginx. What you described is exactly what I intend to implement though, and I believe my Mastodon install is already configured properly for that to work. It's just the Lemmy Easy Deploy script that tries to bind all traffic on port 443 where I run into problems.

[–] immibis@social.immibis.com 4 points 1 year ago (1 children)

@TrinityTek vhosts also refers to the general concept. In nginx you configure multiple servers with the same listening addresses but different names.

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

Yes, it's very similar in Apache, but different enough for me to feel a little out of my comfort zone. I appreciate the tips.

[–] immibis@social.immibis.com 2 points 1 year ago (1 children)

Here's what I have for Pleroma.

server {
server_name social.immibis.com; # this is what matches the domain name
root /var/www/social_html; # empty folder
location / {
proxy_pass http://localhost:4000;
}

# this block was from the pleroma documentation, I think. Mastodon and Lemmy might have their own recommendations. Upgrade is to enable proxying websockets. and the rest seems generally sensible for proxying.
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 16m;
ignore_invalid_headers off;

# when you run Certbot it will change this to 443, insert SSL configuration, and set up a redirect on port 80
listen [::]:80;
listen 80;
}

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

Thank you for sharing your config and advice! I appreciate it. I got it working along with ssl certs installed with certbot and all is well. Cheers!

[–] CommunityLinkFixer@lemmings.world 1 points 1 year ago (1 children)

Hi there! Looks like you linked to a Lemmy community using an URL instead of its name, which doesn't work well for people on different instances. Try fixing it like this: !your_community_name@your.server.name.example

[–] exu@feditown.com 2 points 1 year ago

Nice that somebody has already made a bot for this