LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
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, 01: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, 07: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, 09:53 PM   #3
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 34
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, 10: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, 10:52 PM   #5
vimal
Red Hat India
 
Registered: Nov 2004
Location: Kerala/Pune,india
Distribution: RedHat, Fedora
Posts: 260

Rep: Reputation: 34
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:58 AM
IP and Domain resolving to default virtual host DropHit Linux - Newbie 4 11-19-2005 03:42 PM
what would make ever virtual domain name resolve to one domain name on my system kuplo Linux - Newbie 1 11-14-2005 07:57 PM
Cant get entry in bind to work with domain.com instead of www.domain.com pxes351 Linux - Networking 12 05-09-2005 07:20 AM
having problems getting the www to work with my domain name slawrence Linux - Networking 2 07-04-2004 11:13 AM


All times are GMT -5. The time now is 12:19 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration