-1

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

Tempster102
  • 9
  • 1
  • 3
  • Why don't you use Lets Encrypt (free) and then use sub domains? – Joe Brailsford Jun 27 '17 at 07:29
  • Hi Joe, because I already have the certificate and it just renewed a few months ago so I have 9+ months left on it so I figured I would use what I've already paid for. – Tempster102 Jun 27 '17 at 07:31
  • Well to handle your dynamic IP situation, you either need to ask your ISP for a static or use a service like No-IP – Joe Brailsford Jun 27 '17 at 07:33
  • Hi Joe, I already have Dynamic DNS setup via my DNS provider (Namecheap) the problem I'm running into is how to use that on the NGINX install on the VPS with reverse proxy. – Tempster102 Jun 27 '17 at 07:37
  • Take a look at my answer. – Joe Brailsford Jun 27 '17 at 07:52
  • question is offtopic: Questions should demonstrate reasonable information technology management practices. Questions that relate to unsupported hardware or software platforms or unmaintained environments may not be suitable for Server Fault. – djdomi Dec 25 '21 at 16:38

1 Answers1

0

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;
    }
}
Joe Brailsford
  • 1,181
  • 8
  • 10
  • Hi Joe, apologizes for the delayed reply. So if I'm understanding you correctly what I should do is setup a sub domain that points to my DDNS and then reverse proxy off that for any 'location' that points to my home network? Will that allow the SSL Cert on my NAS to work properly (VPS and NAS would have the same Cert installed)? – Tempster102 Jun 27 '17 at 21:16