should virtual hosts be defined as CNAME in DNS server? - apache

Apache doc regarding virtual hosts states:
Your server has a single IP address, and multiple aliases (CNAMES) point to this machine in DNS. You want to run a web server for www.example.com and www.example.org on this machine.
Am I right to assume that I can also bind two domains to this single IP address using A DNS records, instead of creating one A record and CNAME record for another domain pointing to the first domain? I mean that it won't affect Apache's functionality.

Correct. The browser passes the name it is requesting. It does not care what type of DNS record was used to resolve the name to an ip address.
I usually use Cnames though for the actual domain. and point it at an a record that just represents the ip. Just a way to organize things and make it easier in the future.

Related

How to use Let's Encrypt for my private server while ISP blocked port 80 and 443?

I am setting up a WebDAV server behind traefik using docker compose. Also,I want to add HTTPS support to it, so that keeping my data private. I bought a domain name and prefer to use Let's Encrypt, because it's free of charge.
But as far as I know, Let's Encrypt requires TLS, HTTP or DNS challenge. While last option seems only for big companies who owns the public DNS server, other two options need port 80 or 443. The problem is that these 2 port are all blocked by the ISP. So is there any workaround? How to make it work?
While last option seems only for big companies who owns the public DNS server
If you own the domain, you should have full control over the DNS records — free of charge, by going to the vendor you bought the domain from, and finding the section for the DNS controls. If you have your domain pointing your IP address, you've already used it, probably by adding an A or AAAA record. Let's Encrypt DNS challenge requires only a TXT record, which should be available on virtually every domain registrar's DNS controls.

DNS: Do i need to create a DNS entry to represent each of my web applications running in a same windows server under IIS?

Updated the question:
Assume that i run several web applications in one windows server under IIS. As you know, for the several web applications to co-exist in IIS, i need to differentiate them using a hostname, ip address or port combinations. Assuming that i go with defining a hostname binding unique for each of the web applications, do i need to create a DNS entry for the hostnames to be resolved?
There are three different sites i host in IIS in the same windows server. I can not allocate different ip address to each of my dev sites so i chose to use unique host names for each of the sites thus
api-orders.dev
api-catalog.dev
api-products.dev
etc..
api - indicates it is a web api.
orders | catalog | products - indicate it is an application serving a business department.
dev - indicates it is my development site.
My organization has several domains such as usdev.org.com, us.org.com, uk.dtt.org.com and more like.
Assuming that my Dev servers are hosted in the usdev.org.com domain. I should be able to request my hypothetical sites from within and also outside of the usdev.org.com domain
right now, when i use the below urls, i am not able to hit the site within or outside the domain. Not even from the web server where the sites are hosted. I ask this question to several people and could not get a clear response.
DO i need to create DNS entries corresponding to the hostname IIS binding of each site in order to solve this issue?
api-orders.dev.computer-name.domain.com
api-catalog.dev.computer-name.domain.com
api-products.dev.computer-name.domain.com
What kind of setup i need to acheive this?
If you just want to access the website via your Active directory. I think you shouldn't include servername in your domain name.
Because in common AD DNS Forward Lookup Zone.
You should have a primary zone called domain.com. Your web server will displayed as a HOST(A) Servername and its FQDN will be servername.domain.com.
Then you could create a CNAME api-orders.dev and map it to your servername.domain.com. The FQDN should be api-orders.dev.domain.com.
Finally you have to set the domain into IIS binding so that IIS can share 80 port for mutiple sites.
Since your cname api-orders.dev will not be considered as a seperate website, you have to input FQDN instead of CNAME.
If you want to access the website from internet, then you may need to purchase public domain from domain provider and map it to your server's public IP address.

Web site not accessible when "www" is not used

I have a web domain registered and a hosting space.
When I access my website with www (for ex. www.example.com) it shows expected content. However when I try to access it without www (for ex. example.com) it shows site under construction page. This site under construction page is provided by web hosting provider and is html file.
What changes are required for accessing site both ways?
setup an A-record for the domain name without the 'www' prefix pointing to the IP address of
the web-server, and setup a CNAME-record for the domain name with the 'www' prefix pointing
to the web-server IP.
use a CNAME record for "www" to point it to the base name. Use an A record for the base name.
But I find it easier (and it's ever so slightly faster for users) to simply use an A record for both the base name and www.
Creating A record and CNAME record usually is the solution - but on your authoritative DNS.
You will want to put A and/or CNAME records into master DNS, not secondary DNS. There are two approaches to DNS which are:
authoritative DNS (master DNS)
local DNS (usually resides on your host machine/router) (secondary DNS)
Indeed - it is not simple as it may seemed. To have your own working authoriative DNS, you need 2 host machines physcially connected to two different separated ip addresses (eth0 physical connect - not virtually bridged). Since this is so complicated and time-consuming implemention, it is typical to outsource master DNS to a DNS provider (and is a common practice among many of us).
I have 4 servers on my one ip, and my local DNS are being managed in between my router and 4 host machines and it works great on local network ONLY. Since I wanted the local network to be hooked to my domain, I outsourced my master DNS to http://dnsimple.com (there are other DNS provider competitors), so it'd manage my domain directly. This therefore functions as an authoritative DNS, known as master DNS.
The issue you are trying to fix should be focused toward master DNS, not secondary DNS (local network) as it'd not work. If you got your domain via a registrar company or a web-hosting company, you should be able to find the setting/management on your account with the company (for example, C-Panel)...not DNS on your local network.
EDITED: This is a tool that I always use and is a great benefit in tackling down DNS / Domain issues. I dont know what I'd have done without it. http://www.dnsstuff.com/tools

How do I redirect a specific port for my subdomain to another IP address

Ok so I have a domain registered, for these purposes I will refer to it as mydomain.com.
I also have Shared Hosting (just fyi) so I may be restricted in doing what I am planning.
So basically I have a sub-domain, gserver.mydomain.com, which points to a directory on the Host server showing basically a seperate website for this subdomain displaying information about it's corresponding gameserver.
Since it's about a gameserver, naturally I would want gserver.mydomain.com to also direct users to the gameserver's IP but I can't have it both to the Web Server and Game Server in the zone record as they are seperate IPs.
If the gameserver listens on.. let's say port 2400, then is it possible to have gserver.mydomain.com:2400 point to another IP (the gameserver's IP) while still retaining the Web Hosts IP on port 80.
I have a general idea of how to go about it but with the current Hosting Plan, restrictions may be preventing me.
Talking about DNS, it's not possible to use port (tcp or udp) information, as it handles only name/ip's (basicaly).
So, gserver.mydomain.com will always be resolved to the IP in the DNS database, regardless of the :port. Actualy, the :port is not part of the DNS name.
If all of your server will be HTTP servers and you have access to an Apache web servers, you can use something like proxy_pass.
You can take a look at this link http://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass

Using domain database in subdomain

Is it possible that we have one domain where database and site is hosted on the single dedicated IP.
If we wish to host domains subdomain on another dedicated IP address and use the domains databse to display quotes.
Will it be done or not. Or we have to host the subdomain also in same domain with same IP address?
Yes, you can host a site and a database on the same domain name and the same IP. If they are separate servers, you need a router so that it can route different ports to separate local IP addresses.
Yes, you can have a subdomain on a different IP, and you can access the database either from the outside (public / separate local net) or from the same local net. You can have a separate IP for the subcomain even if you use the same router and put the server in the same local net.
Yes. surely different domains/subdomains can be assigned to different servers/IPs and surely you can access a database remotely from a separate machine. Your primary site and the one that your subdomain refers to can be served by a single database residing on the primary site's machine.