Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, Well, here we go: My system: CentOS Linux 5.4 As my VPS provider filters port 53 I use free dns.afraid.org dns's service. For testing purposes I'm using co.cc free ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    6

    [SOLVED]httpd virtualserver doesn't show proper page


    Hi,
    Well, here we go:

    My system: CentOS Linux 5.4

    As my VPS provider filters port 53 I use freedns.afraid.org dns's service.

    For testing purposes I'm using co.cc free domain names. (I like the word "free")

    And here are the configurations:

    On co.cc:

    Code:
    Domain : 	gassgassnet.Co.CC
    Service Type : 	Name server (DNS)
    Name server : 	ns1.afraid.org
    ns2.afraid.org
    ns3.afraid.org
    ns4.afraid.org
    Code:
    Domain : 	oremosjuntos.Co.CC
    Service Type : 	Name server (DNS)
    Name server : 	ns1.afraid.org
    ns2.afraid.org
    ns3.afraid.org
    ns4.afraid.org
    On freedns.afraid.org:

    Code:
    gassgassnet.co.cc:
    	gassgassnet.co.cc (G)	A	190.120.229.160
    	www,gassgassnet.co.cc (G)	CNAME	gassgassnet.co.cc
    
    oremosjuntos.co.cc:
    	oremosjuntos.co.cc (G)	A	190.120.229.160
    	www,oremosjuntos.co.cc (G)	CNAME	oremosjuntos.co.cc
    The coma (,) that you see after "www" is because I can not post urls in this forum. On dns server is actualy a dot (.)

    And now my server configurations:

    httpd.conf:

    Code:
    <VirtualHost gassgassnet.co.cc:80>
    DocumentRoot "/var/www/html/gassgassnet.co.cc/html"
    <Directory "/var/www/html/gassgassnet.co.cc/html">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>
    
    <VirtualHost oremosjuntos.co.cc:80>
    DocumentRoot "/var/www/html/oremosjuntos.co.cc/html"
    <Directory "/var/www/html/oremosjuntos.co.cc/html">
    allow from all
    Options +Indexes
    </Directory>
    </VirtualHost>
    (I can't post the complete file due to I'm not 11 post old in this forum)

    The prolem I have is that wen I browse gassgassnet,co,cc it shows me the index file on /var/www/html/gassgassnet.co.cc/html (It's correct).

    When I browse oremosjuntos,co,cc it shows me the index file on /var/www/html/oremosjuntos.co.cc/html (It's correct).

    Wen I browse www,gassgassnet,co,cc it shows me the index file on /var/www/html/gassgassnet.co.cc/html (It's correct).

    But...

    When I browse www,oremosjuntos,co,cc it shows me the index file on /var/www/html/gassgassnet.co.cc/html (WRONG)

    ¿Why?

    I will apreciatte any help.
    Thanks to all.
    Last edited by gassganso; 03-17-2010 at 05:24 PM. Reason: [SOLVED]

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    626
    normally when apache cannot find a match it will default to either the global document root or the first available virtual host. So when you say oremosjuntos.co.cc of course it will find a match. When you say www.oremosjuntos.co.cc, that is a completely different host all together.

    There are a couple of ways to handle it. One way, and probably the best way imo is to use the rewrite engine to remove or add 'www' to all incoming requests. Then change the name appropriately, in the case of you choosing to add www to the hostname.

    You should able to google it and find a cornucopia of examples. apache rewrite tutorials or something should guide you in the write direction.
    linux user # 503963

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,356
    Because apache defaults to the first virtual host, if the servername is not matched.

    Have a look at the ServerAlias statememt and add what you need.
    You can also use globbing with ServerAlias
    You must always face the curtain with a bow.

  4. #4
    Just Joined!
    Join Date
    Mar 2010
    Posts
    6
    Right, solved.

    Thanks to both. I used ServerAlias and everything works peferctly

    Thx again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •