6
submitted 3 years ago by root@lemmy.world to c/selfhosted@lemmy.world

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?

you are viewing a single comment's thread
view the rest of the comments
[-] 0x0f 1 points 3 years ago* (last edited 3 years ago)

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.

this post was submitted on 10 Jun 2023
6 points (100.0% liked)

Selfhosted

60861 readers
479 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:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 3 years ago
MODERATORS