Nginx Reverse proxy on subdomain

napstersquest

Thread Police
Adept
The use case is as follows:

I have a home NAS with OpenMediaVault on it, running multiple services.
Want to use Nginx reverse proxy to tunnel all my traffic over HTTPS.

Saw a tutorial:

But the difference is,

In the tutorial the creator points his main domain (let's say domain.com) to his static IP pointing to his home server.
But I already own a domain and the domain already points to a site which I can't change.

I want sub.domain.com to point to my static IP,

then app1.sub.domain.com or app1.domain.com (both will work for me) to the app interface (which will be done via Nginx Reverse Proxy).

Is it at all possible? Or should I just buy a new domain?
 
It's definitely possible. I have done it in the past. My domain was pointing to my VPS on Contabo, which also had a wireguard tunnel. Using this wireguard tunnel, I was able to access my home computer over the Internet via a sub domain, that too with https.

Unfortunately it was just an experimental setup which I made for learning purposes and I did it over 6 months ago, so I don't remember the steps. But I just wanted to let you know that it's possible.

Also, as far as ngnix is concerned, a sub domain is just another domain (at least at a basic level at which I was working. I had two domains and didn't see any difference in configuring primary domain and sub domain).
 
want sub.domain.com to point to my static IP,
assuming you have access to domain control panel to update your DNS, this is feasible solution.

From the video perspective, you use subdomain while the video host assumes domain and if you have noted command he ran, just replace domain with subdomain. Post that you should be able to access the OMV and other applications through Nginx.

For Management purpose, I will suggest use of Cloudflare or nginx proxy manager.
 
In your domain DNS settings, set up a A record for the subdomain pointing to the IP you want

1656483955348.png
 
I have this setup currently but am not in the local environment currently. It works pretty well. I have a static IP (paying extra for that). I used the following tutorials for my setup:

Another: https://shollyethan.medium.com/conf...r-cloudflare-and-a-custom-domain-100b5175fba2

I can share further details in a few days when I get home. I have attached my cloudflare DNS settings screenshot.
Full docker compose looks like this:

version: "3.7"

services:

reverse-proxy:
image: "jwilder/nginx-proxy:latest"
container_name: "reverse-proxy"
volumes:
- "html:/usr/share/nginx/html"
- "dhparam:/etc/nginx/dhparam"
- "vhost:/etc/nginx/vhost.d"
- "certs:/etc/nginx/certs"
- "/run/docker.sock:/tmp/docker.sock:ro"
restart: "always"
networks:
- "net"
ports:
- "86:80"
- "444:443"
letsencrypt:
image: "jrcs/letsencrypt-nginx-proxy-companion:latest"
container_name: "letsencrypt-helper"
volumes:
- "html:/usr/share/nginx/html"
- "dhparam:/etc/nginx/dhparam"
- "vhost:/etc/nginx/vhost.d"
- "certs:/etc/nginx/certs"
- "/run/docker.sock:/var/run/docker.sock:ro"
environment:
NGINX_PROXY_CONTAINER: "reverse-proxy"
DEFAULT_EMAIL: "youremail@gmail.com"
restart: "always"
depends_on:
- "reverse-proxy"
networks:
- "proxynet"
volumes:
certs:
html:
vhost:
dhparam:

networks:
proxynet:
external: true
 

Attachments

  • cloudflare_settings.png
    cloudflare_settings.png
    31.7 KB · Views: 147
Last edited:
THANK YOU GUYS SO MUCH!

I forgot to post this, but yes I do have static IP from my ISP.

I had set up A record in DNS as follows
homeserver.mydomain.com --> Static IP from ISP

but I had added CNAME records for
app1, app2 etc
Which didn't work.

Like you guys suggested,
added A records in DNS:
app1.mydomain.com --> Static IP from ISP

Also forwarded 80, 81 and 443 ports for Nginx through my router (I think I may have missed this before)

Now everything works like it should.
 
Back
Top