Set up for Multiple IP to single DNS - nginx

I have installed nginx load balancer on two server . I want to assign one same DNS for both IP of server!
So that I can use assign DNS for hitting request which will route request on both nginx server simultaneously!!
Thanks on advance !!
I wanted do it virtually...not through fqdn.

I have installed nginx load balancer on two server . I want to assign one same DNS for both IP of server! So that I can use assign DNS for hitting request which will route request on both nginx server simultaneously!! Thanks on advance !! I wanted do it virtually...not through fqdn.
Follow the normal procedure to assign a single IP address to a DNS name.
Repeat once, for the other IP address.
Good luck!

Related

What's the different use IP directly and config the local host?

I try to use IP directly access a URL by HTTP protocol, there are two methods here:
Use the URL which the domain replace with its IP
Config the IP and domain pair in local host of system
When the http request arrived the server, from the point of the server view, what's the different between the both request?
There would be no difference to the server. It is up to the client to resolve domain names to their IP addresses and there are a few ways to do that. One is to use a DNS server, another is to use the hosts file.
To add on, the domain is most certainly sent in the HTTP request. The browser (or other HTTP client) is responsible for that. If you use the IP, then no domain will arrive at the server, meaning it will serve up whatever is configured as the default content for the IP. The domain info is what allows the server to server multiple domains on a single IP.
Consider a Client connects to a Server.
First thing your computer does, is to analize the address you input.
If you wrote an IP, nothing to do now. If you wrote a domain, it will 'resolve' domain.
Resolving domain (DNS) means to 'translate' your URL into an IP. When computer resolves the domain, it will only use the new IP it got.
Client is sending packages with meta-data, that includes where this package is from (client's ip), where it may reach (server's ip), destin port etc.
Domain is not included on network packages.
Only IPs are included.
That means the server could never know if user connected to it using a domain or its ip directly.

Host command providing wrong twitter IP address

I'm building a clone of the host command. I've tried finding the host of twitter.com and have received the same IP-Address both on my version and the real host command. The address is: 104.244.42.65.
For some reason, when I input this IP-Address into the browser, it says that there's no webpage with that IP address. Why is this happening?
The host command uses ICMP to detect if the DNS name of the host can be resolved and host is reachable. And you can resolve and reach the IP that resolved for twitter.com.
However, the web server of Twitter is probably configured to answer only if asked by DNS name and when your browser sends a HTTP GET request with the IP, the server does not respond.
Twitter gets tons of requests per minute. The surely use load-balancers that redirect "twitter.com" to multiple IP addresses and they don't want people to use particular IP addresses, which would mess up their load balancers.

Which name is passed to Nginx when using CNAME

I have a Nginx server on my own server. I have a DDNS from asuscomm.com e.g. mydomain.asuscomm.com. Now I want to be able to handle to different sites using CNAME and Nginx.
www.domain1.com and www.domain2.com. In my DNS I want both to point to mydomain.asuscomm.com, and then depending on if it is www.domain1.com or www.domain2.com I want to show different sites.
Is it possible to do with CNAME and Nginx, or do I have to have an A pointer for this?
Thanks in advance.
CNAME is pointer to domain, and A is pointer to IP, you need to define A for IP (Nginx port 80).
You can try subdomain for nginx

Is it ok to host multiple sites on a server with one IP address?

I wonder if is it ok to host multiple sites on a server with one IP address?
I bought server on hetzner and I want to host 10 different websites of my clients. Eg. client1.com, client2.net, client3.org etc. I changed "A record" in all domains on IP address of my server. Is there any reasons to not do that? Or maybe I should buy additional IP address for each site?
Thank You.
Sure it is, your webserver will be able to filter requests to the correct site based on the incoming request's URL.
In Apache this is done by adding a new virtual host to your configuration.

IP Addresses for Domains and their Subdomains the same?

I would like to know. When a domain example.com has an IP address: 41.72.111.222, would any of its subdomains (sub.example.com, mail.example.com etc) have the same IP address listed in the DNS records? Or does it work like this: A request is sent from the browser to the DNS server for sub.example.com. The DNS server returns the IP address for example.com, and the split/differentiation is made when the request for sub.example.com hits the example.com host server? So the host server basically know what to do with sub.example.com and not the DNS server?
It can kind of be a combination of both. Ultimately, though, the decisions are made based on what you set your DNS settings to be. Your host (or hosts) will then get whatever traffic you determined they should get in your DNS settings.
So for example...
You can set your DNS settings to take [anything].example.com and always direct that to your server. You would do this by adding a wildcard entry to your DNS subdomains. Wildcard entries use a * symbol to mean "anything". You would then need to configure your server to know what to do with all these different potential subdomains it could be receiving.
At the same time, you can set specific subdomains to go to other hosts. For example, if you wanted mail.example.com to go to some other webmail host, you would set up in your DNS the subdomain "mail" and have that traffic redirected to wherever you were hosting your webmail.

Resources