LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Problem with DNS and VirtualHost (https://www.linuxquestions.org/questions/linux-server-73/problem-with-dns-and-virtualhost-698894/)

Rauldinho 01-21-2009 10:27 AM

Problem with DNS and VirtualHost
 
Hi, i'm having a problem with the configuration of two virtual host in an apache web server. The IP of my web server is 192.168.1.20 and the 2 domains are support.domain.com and documentation.domain.com. In my local DNS the configuration for these domains are as follow. The 2 domains point to the web server correctly, but the problem is that in the virtual host configuration in apache the 2 domains are using only one of them, i mean, both domain point to the same virtual host. I think the problem is because one of the domains is configured with a CNAME record that uses the other domain name and apache sees it like the same, i just want to be sure since i'm not the one that administrates the DNS. Thanks for any answer i may get.


Quote:

user@server:~$ host -a support.cvgin.com Trying "support.domain.com" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60862 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2 ;; QUESTION SECTION: ;support.domain.com. IN ANY ;; ANSWER SECTION: support.domain.com. 38400 IN CNAME documentation.domain.com.

Quote:

user@server:~$ host -a documentation.domain.com Trying "documentation.domain.com" ;; QUESTION SECTION: ;documentation.domain.com. IN ANY ;; ANSWER SECTION: documentation.domain.com. 38400 IN A 192.168.1.20 Received 147 bytes from 160.100.1.208#53 in 2 ms

Berhanie 01-21-2009 11:29 AM

Quote:

I think the problem is because one of the domains is configured with a CNAME record that uses the other domain name and apache sees it like the same,
No, that's not the problem. It doesn't matter how the name is resolved to an IP address, whether by A record or via CNAME. The client still tells the web server the original name using a "Host: " header. That's the point of virtual hosts: that different sites can be hosted on a single IP address.

AuroraCA 01-21-2009 11:40 AM

You should have the domain names resolve from your registrar to your server IP. Once the connection reaches your server IP address the the VirtualName will resolve the the correct virtual host name. Use the Address rather than CName.

Code:

www.hostname.com    Address      xxx.xxx.xxx.xxx
sub.hostname.com    Address      xxx.xxx.xxx.xxx

Then set up your virtual hosts in either your /etc/http.conf file or /etc/apache2/sites-available to resolve the URL to the correct DocumentRoot and other directives.


All times are GMT -5. The time now is 12:32 PM.