TransWikia.com

NGINX Reverse Proxy to Dynamic DNS

Server Fault Asked by Tempster102 on September 23, 2020

I have a VPS that hosts my personal portfolio. My DNS (*) is set to point to the VPS’s IP. I’m also setting up some local self-hosted (Off a NAS in my home) applications such as Cloud storage and sync, etc… I would like to use the NGINX server already running on the VPS to resolve to these local self-hosted services but since they are at home they are on a a dynamic IP from my ISP.

I would like to do the follow:

I’ve been reading the NGINX docs, reddit and posts on ServerFault but can’t wrap my head around the setup. I would also like for both above URL to use my SSL certificate; note I don’t have a wildcard certificate which is why I’m not using sub domains.

Thanks

One Answer

Once you've sorted your issue with your IP, either asking for a static or using a service like No-IP, you'll want an Nginx conf like this... (You'll have to add your ssl configuration, but I'm guessing you know how to do that)

server {
  listen 443;
  server_name example.com;
    location /cloud {
      proxy_pass <insert NAS public ip / no-ip hostname here>:<port if needed>;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto https;
    }
}

Answered by Joe Brailsford on September 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP