Hey all,

So I’ve been playing with Nginx so that I can reference my self hosted services internally by hostname rather than by IP and port.

I set some custom entries in my pihole, setup the proxies on Nxing, and boom. All is working as expected. I can access Jellyfin via jellyfin.homelab, amp via amp.homelab, etc.

I wanted to have all of these internally facing, because I don’t really have a need for them outside of my network, and really just wanted the convenience of referencing them.

Question 1) If I wanted to add SSL certs to my made up homelab domain, how hard would that be?

Question 2) When accessing something like Jellyfin via jellyfin.homelab, all traffic is then going through my nginx VM, correct? Or is Nginx just acting as a sort of lookup which passes on the correct IP and port information?

1 point
*

1: not very hard actually, the hardest part is gettin the cert onto your other devices x3
all you need to do is add each subdomain to the cert, add ssl_certificate and ssl_certificate_key to the http block, then enable ssl for each subdomain, like so:

http {
    # cert
    ssl_certificate /etc/nginx/public.crt;
    ssl_certificate_key /etc/nginx/private.key;
    server {
        listen       12345:443 ssl;
        server_name  pi.hole;

        location / {
                proxy_pass http://localhost:80;
        }
    }
    server {
        listen       12345:443 ssl;
        server_name  fox.hole;

        location / {
                proxy_pass http://localhost:621;
        }
    }
}

2: correct, all traffic goes through nginx.

permalink
report
reply
1 point

Hey there,

I have somewhat of a similar setup. I use Nginx Proxy Manager and AdGuard Homes rewrites to do the same thing as you.

As for Question 1: Creating self-signed certs is pretty straightforward. I followed this tutorial by Christian Lempa: https://youtu.be/VH4gXcvkmOY He also has a good writeup on his GitHub: https://github.com/ChristianLempa/cheat-sheets/blob/main/misc/ssl-certs.md How to import the certs into Nginx, I don’t know, but I think that’s easy to lookup online.

Regarding Question 2: My understanding is that all traffic goes through the Reverse Proxy.

I hope I could help, let me know if you have any more questions.

permalink
report
reply
1 point
  • in order to add certs you would need a certificate authority, capable of setting up a proper certificate chain. There are several, ranging from the super simple like mkcert to full scale management tools like openCA. The second step is harder and require your consuming apps (the devices and apps that connects to your jellyfin) to trust your CA. An alternative would be to have a proper domain and use LetsEncrypt to get a cert, then trust will work out of the box, but it might also leak information about your private infrastructure.

  • traffic will go through your proxy

permalink
report
reply
0 points

Ah I see. I think I read somewhere that using your own cert requires you to add it to each device that will access said service, which for me is a bit of a deal breaker. I don’t think the rest of the family would be too thrilled; I have to make my projects somewhat transparent to them XD

permalink
report
parent
reply
0 points

Yes, I personally have a valid domain name and then use a wildcart cert so that anything.mydomain.com is valid.

permalink
report
parent
reply
1 point

I have a couple domains as well, but was hoping to not rely on anything external for this setup. I’ll think about it. Would definitely make adding SSL a lot easier.

permalink
report
parent
reply
0 points

I use a real domain name, but only have them available internally (and use WireGuard to access them when out and about). You can use letsencrypt with them then because you can validate through DNS.

permalink
report
parent
reply
1 point

I see. I have a valid domain as well that I could use, which would make things easier. I guess after I set things up, I can lock down Nginx/ my home lab again, and the certs would still work. My biggest worry was exposing my internal systems to the world.

permalink
report
parent
reply

Selfhosted

!selfhosted@lemmy.world

Create post

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!

Community stats

  • 4.8K

    Monthly active users

  • 3.6K

    Posts

  • 81K

    Comments