Domain Name Point to Dynamic IP Automatically

If don’t have static IP, but want to serve websites, do this:

1. Signup for dyndns or no-ip or any.
Set it up to update automatically
(using app or available option in some router)
See their website for instructions.

2. Set CNAME in domain name control panel.
For example:
no-ip domain name is: poop.ddns.net
your domain is: awesome.com
in CNAME, put
name: iam
value: poop.ddns.net
TTL: 4hr or just pick any
This means when you typed iam.awesome.com will reach to IP address assigned in poop.ddns.net
The browser will still see it as iam.awesome.com

3. Configure NGINX to read iam.awesome.com and serve the website desired
add this line: proxy_set_header Host $host;
or a bit longer example:

server {
    listen 80;
    server_name iam.awesome.com;
    location / {
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:3434;
        proxy_redirect off;
    }
}
server {
    listen 80;
    server_name urnot.awesome.com;
    location / {
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:3435;
        proxy_redirect off;
    }
}
server {
    listen 80;
    server_name me.awesome.com;
    location / {
        proxy_set_header Host $host;
        proxy_pass http://127.0.0.1:3436;
        proxy_redirect off;
    }
}   

Was this helpful?

0 / 0