157
submitted 5 days ago* (last edited 5 days ago) by Allero@lemmy.today to c/selfhosted@lemmy.world

I'm pretty new to selfhosting and homelabs, and I would appreciate a simple-worded explanation here. Details are always welcome!

So, I have a home network with a dynamic external IP address. I already have my Synology NAS exposed to the Internet with DDNS - this was done using the interface, so didn't require much technical knowledge.

Now, I would like to add another server (currently testing with Raspberry Pi) in the same LAN that would also be externally reachable, either through a subdomain (preferable), or through specific ports. How do I go about it?

P.S. Apparently, what I've tried on the router does work, it's just that my NAS was sitting in the DMZ. Now it works!

top 50 comments
sorted by: hot top controversial new old
[-] tofu@lemmy.nocturnal.garden 65 points 5 days ago

You need a reserve proxy. That's a piece of software that takes the requests and puts them toward the correct endpoint.

You need to create port forwards in the router and direct 80 and 443 (or whatever you're using) toward the host of the reverse proxy and that is listening to on those ports. If it recognized the requests are for nas.your.domain, it will forward the requests to the NAS.

Common reverse proxies are nginx or caddy. You can install it on your raspberry, it doesn't need it's own device.

If you don't want that, you can create different port forwards on your router (e.g. 8080 and 8443 to the Raspi) and configure your service on the Raspi corresponding. But it doesn't scale well and you'd need to call everything with the port and the reverse proxy is the usual solution.

[-] Allero@lemmy.today 3 points 5 days ago

There's an issue with that first part. Do I configure it right? Should :8100 be redirected to 192.168.0.113:81 in this case?

[-] infeeeee@lemmy.zip 10 points 5 days ago

External 80 to internal 80 and external 443 to internal 443

With this config you don't have to deal with ports later, as http is 80, https is 443 by default.

If you run some container on port 81, you have to deal with that in the reverse proxy, not in the router. E.g. redirect something.domian.tld to 192.168.0.103:81

If you use docker check out nginxproxymanager, it has a very beginner friendly admin webui. You shouldn't forward the admin ui's port, you need to access it only from your lan.

load more comments (5 replies)
load more comments (2 replies)
[-] fibojoly@sh.itjust.works 32 points 5 days ago

Welcome to the wonderful world of reverse proxies!

[-] possiblylinux127@lemmy.zip 8 points 4 days ago

What are you running?

If it is http based use a reverse proxy like Caddy

[-] Allero@lemmy.today 4 points 4 days ago

Update: tried Caddy, love it, dead simple, super fast, and absolutely works!

[-] possiblylinux127@lemmy.zip 2 points 4 days ago

Did you also forward UDP port 443?

If not I would as well since it is used for QUIC which is supported and automatically turned on for Caddy.

[-] Allero@lemmy.today 1 points 4 days ago
load more comments (9 replies)
[-] pleksi@sopuli.xyz 7 points 4 days ago

I really feel like people who are beginners shouldnt play with exposing their services. When you set up Caddy or some other reverse proxy and actually monitor it with something like fail2ban you can see that the crawlers etc are pretty fast to find your services. If any user has a very poor password (or is reusing a leaked one) then someone has pretty open access to their stuff and you wont even notice unless you’re logging stuff.

Of course you can set up 2FA etc but that’s pretty involved compared to a simple wg tunnel that lives on your router.

load more comments (2 replies)
[-] Nate066@lemmy.world 12 points 5 days ago* (last edited 5 days ago)

VPN is definitely the way to go for home networks. Your router even has one built in. OpenVPN and Wireguard are good.

If you really want to expose stuff like this the proper way is to isolate your home network from your internet exposed network using a VLAN. Then use a reverse proxy, like caddy and place everything behind it.

Another benefit of a reverse proxy is you don't need to setup https certs on everything just the proxy.

You do need a business or prosumer router for this though. Something like Firewalla or setting up a OpenWRT or OPNsense.

Synology also has there quick connect service as well. While not great if you keep UPNP off and ensure your firewall and login rate limiting is turned on it may be better then just directly exposing stuff. But its had its fair share of problems so yeah.

Consider not self hosting everything. For example if all your family cares about is private photo storage, consider using a open source E2EE encrypted service for photos on the cloud like Ente Photos. Then you can use VPN for the rest. https://www.privacyguides.org/ has some recommendations for privacy friendly stuff.

Also consider the fallout that would happen if you are hacked. If all your photos and other things get leaked because your setup was not secure was it really any better than using big tech?

If nothing else please tell me you are using properly setup https certs from Let's Encrypt or another good CA. Using a firewall and have login rate limiting setup on everything that is exposed. You can also test your SSL setup using something like https://www.ssllabs.com/ssltest/

[-] Allero@lemmy.today 4 points 5 days ago* (last edited 5 days ago)

No truly private photos ever enter the NAS, so on that front it should be fine.

VPN is not an option for several reasons, unfortunately.

But I do have a Let's Encrypt certificate, firewall and I ban IP after 5 unsuccessful login attempts. I also have SSH disabled completely.

SSL Test gave me a rating of A

[-] webghost0101@sopuli.xyz 9 points 5 days ago

Whispers “try proxmox”

[-] Allero@lemmy.today 3 points 5 days ago

I will eventually!

But for all I understand, it is to put many services on one machine, and I already have a NAS that is not going anywhere

load more comments (2 replies)
[-] bizdelnick@lemmy.ml 12 points 5 days ago

If you mean HTTP server, what you need is a reverse proxy and name-based virtual hosts. I usually use nginx for such tasks, but you may choose another web server that has these features.

load more comments (4 replies)
[-] greybeard@feddit.online 5 points 4 days ago

The synology NAS can act as a reverse proxy for stuff inside your network. I don't have mine in front of me, so you will have to google the steps, but basically you point the synology to an internal resource and tell it what external subdomain it should respond to.

[-] Allero@lemmy.today 2 points 4 days ago

Yes, I know where this feature is in the settings, but it's got its own issues and I also turn the NAS off for the night, so it's not an option for me.

[-] Joelk111@lemmy.world 3 points 4 days ago

Why do you turn off the NAS at night? Reminds me of my grandparents turning off the wifi at night.

[-] Allero@lemmy.today 2 points 4 days ago* (last edited 4 days ago)

Drives are somewhat noisy (even though I took fairly quiet ones) and I appreciate total silence at night. Unfortunately, I don't have many places to put it outside my single room, so there's that.

I'd love to move to SSDs for storage at some point (I know it's controversial, but they would fit my use case better), but for now it's too expensive for me.

[-] Joelk111@lemmy.world 2 points 4 days ago

Ahh, that's valid. I've been wanting to build a (relatively) small 16TB SSD NAS for video editing, after which I could dump footage to my main NAS. SSD NAS systems can definitely make sense depending on your use case. Hell, you can even game off of them if you've got 10gig networking.

load more comments (1 replies)
load more comments (7 replies)
[-] MangoPenguin 9 points 5 days ago

You can either:

A) Use a different port, just set up the new service to run on a port that's not used by the other service.

B) If it's a TCP service use a reverse proxy and a subdomain.

[-] towerful@programming.dev 8 points 5 days ago

Who is externally reaching these servers?
Joe public? Or just you and people you trust?

If it's Joe public, I wouldn't have the entry point on my home network (I might VPS tunnel, or just VPS host it).

If it's just me and people I trust, I would use VPN for access, as opposed to exposing all these services publicly

[-] Allero@lemmy.today 5 points 5 days ago

Just me and the people I trust, but there are certain inconveniences around using VPN for access.

First, I live in the jurisdiction that is heavily restrictive, so VPN is commonly in use to bypass censorship

Second, I sometimes access my data from computers I trust but can't install VPN clients on

Third, I share my NAS resources with my family, and getting my mom to use a VPN every time she syncs her photos is near impossible

So, fully recognizing the risks, I feel like I have to expose a lot of my services.

load more comments (7 replies)
load more comments (5 replies)
[-] skankhunt42@lemmy.ca 8 points 5 days ago* (last edited 5 days ago)

Router gets the public IP. Login to it, find port forwarding option. You'll pick a public port. IE 443 and forward it to a local IP:port combo, IE 192.168.0.101:443.

Then you can pick another public port and forward it to a different private IP:port combo.

If you want a subdomain, you forward one port to one host and have it do the work. IE configure Nginx to do whatever you want.

EDIT: or you use IPv6. Everything is a public IP.

load more comments (7 replies)
[-] jacksquat@what.forfi.win 5 points 5 days ago

Honestly Cloudflare Tunnels could be a very simple way to do it. I've always had tremendous luck with it. By using CF you can let them do all the heavy lifting instead of hosting your own... as long as you trust them.

[-] rikudou@lemmings.world 4 points 5 days ago* (last edited 5 days ago)

You can use frp to do the same thing a CloudFlare tunnel does without giving them your unencrypted data.

https://github.com/fatedier/frp

load more comments (3 replies)
[-] Allero@lemmy.today 3 points 5 days ago* (last edited 5 days ago)

While not supportive of Big Tech, I do appreciate your piece of advice, and understand self-hosting needs differ!

P.S. Also beware, seems like there's a new attack through Tunnels:

https://www.csoonline.com/article/4009636/phishing-campaign-abuses-cloudflare-tunnels-to-sneak-malware-past-firewalls.html

[-] jacksquat@what.forfi.win 3 points 5 days ago

Thanks for the heads up!

load more comments (1 replies)
[-] Chewy7324@discuss.tchncs.de 4 points 5 days ago

If you go with IPv6, all your devices/servers have their own IP. These IPs are valid in your LAN as well a externally.

But it's still important to use a reverse proxy (e.g. for TLS).

load more comments (3 replies)
[-] EpicFailGuy@lemmy.world 2 points 4 days ago

You already have a lot of good answers ... but I got one more to add.

I have a very similar setup on my homelab and I'm using a Cloudflare tunnel.

It's a free service and it's really good because it allows you to expose web services and specific ports for remote access over dynamic IPs without having to expose your own router.

https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/

load more comments (3 replies)
load more comments
view more: next ›
this post was submitted on 19 Jun 2025
157 points (100.0% liked)

Selfhosted

46672 readers
176 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 2 years ago
MODERATORS