LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2006, 12:41 PM   #1
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Rep: Reputation: 30
Virtual host www.domain.com work, domain.com don't work


Hi, i'm having a problem with a virtual host. Well actually all of them. When someone try to access for example www.domain.com it works great, my server act as the virtual host of that domain. But if someone try to access domain.com my server doesn't act as it's virtual host and just redirect it to "/".
I hope someone could help me to solve this.

Here is the virtual host conf

Code:
NameVirtualHost *:80
<VirtualHost *:80>
   ServerName www.domain.com
   DocumentRoot "/var/www/domain.com"
</VirtualHost>
Here is the master dns conf

Code:
$TTL    86400
; Authoritative data for domain.com
;
@                IN     SOA ns1.domain.com. root.domain.com. (
                        1139830917      ; Serial (yymmddxx)
                        28800           ; refresh, seconds
                        7200            ; retry, seconds
                        604800          ; expire, seconds
                        86400 )         ; minimum, seconds

domain.com.   IN  NS    ns1.domain.com.
domain.com.   IN  NS    ns2.domain.com.
domain.com.   IN  NS    ns3.domain.com.
                 MX 0         mail
domain.com. IN A my_webserver_ip
ns1            IN       A             my_first_dns_ip
ns2            IN       A             my_second_dns_ip
ns3            IN       A             my_third_dns_ip
mail           IN       A             my_mailserver_ip
www            CNAME                  domain.com.
Another question, why dns is so hard to conf?
 
Old 05-03-2006, 06:03 PM   #2
scowles
Member
 
Registered: Sep 2004
Location: Texas, USA
Distribution: Fedora
Posts: 620

Rep: Reputation: 31
Try adding "ServerAlias mydomain.com" to your virtual definition.
 
Old 05-03-2006, 08:53 PM   #3
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hello

In the configuration of virtual hosting,try adding the domain name mydomain.com.


ie..

NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain.com domain.com
DocumentRoot "/var/www/domain.com"
</VirtualHost>

Got it?

I hope this works.


Thanks,
 
Old 05-03-2006, 09:24 PM   #4
stormrider_may
Member
 
Registered: Sep 2005
Distribution: Debian
Posts: 304

Original Poster
Rep: Reputation: 30
Yes i tried this, but got this error

Code:
ServerName takes one argument, The hostname and port of the server
When reloading apache
 
Old 05-03-2006, 09:52 PM   #5
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 36
Hello stormrider_may,

Really sorry to say that, I was not in my senses, i think. You must add 'ServerAlias' not 'ServerName'.

ie..

NameVirtualHost *:80
<VirtualHost *:80>
ServerAlias www.domain.com domain.com
DocumentRoot "/var/www/domain.com"
</VirtualHost>

Thanks,,
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DHCPD is updating BIND with <host>.<domain>.<domain>. diabelek Linux - Networking 15 10-11-2007 05:58 AM
IP and Domain resolving to default virtual host DropHit Linux - Newbie 4 11-19-2005 02:42 PM
what would make ever virtual domain name resolve to one domain name on my system kuplo Linux - Newbie 1 11-14-2005 06:57 PM
Cant get entry in bind to work with domain.com instead of www.domain.com pxes351 Linux - Networking 12 05-09-2005 06:20 AM
having problems getting the www to work with my domain name slawrence Linux - Networking 2 07-04-2004 10:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration