Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: apache namevhosts problem

  1. #1

    Default apache namevhosts problem

    Hello,

    New to these forums, so i apologize if this is in the wrong place.

    The problem:

    I am trying to setup 2 virtual hosts on my apache webserver which is running opensuse 11.1

    In the /etc/apache2/listen.conf file i have my:

    NameVirtualHost *

    in the /etc/apache2/vhosts.d/
    I have 2 files, secure.conf and frontend.conf... both are copies of the template provided by apache.

    When i restart apache, i get no errors at all. If i browse to the url that frontend.conf (domain.com) defines, it works, as expected... when i browse to the other one, secure.domain.com i get a page load error - address not found...

    Im positive that both virtual host files are not the issue, but i can post them here if anyone would like to see them...

    im out of ideas, any suggestions?

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: apache namevhosts problem

    Sounds like secure.domain.com doesn't resolve to your webserver's IP address.

    But to check that you have the namevhosts set up correctly, do:

    /usr/sbin/httpd2 -S

    and post the results.

  3. #3

    Default Re: apache namevhosts problem

    This is what i get:

    VirtualHost configuration:
    wildcard NameVirtualHosts and _default_ servers:
    *:* is a NameVirtualHost
    default server www.krm-tech.com (/etc/apache2/vhosts.d/front.conf:16)
    port * namevhost www.krm-tech.com (/etc/apache2/vhosts.d/front.conf:16)
    port * namevhost www.secure.krm-tech.com (/etc/apache2/vhosts.d/secure.conf:16)
    Syntax OK

    it almost looks like some default site is still there... i dont know

    This make any sense?

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: apache namevhosts problem

    Yes, it will work, provided www.secure.krm-tech.com resolves to your server's IP address. From your browser's error message, that doesn't seem to be happening. You are aware that you have to point the vhost domain name to the IP address in DNS, right? You can't just write a couple of conf files and have it work.

  5. #5

    Default Re: apache namevhosts problem

    I added a line for it in /etc/hosts ... is this not enough?

  6. #6

    Default Re: apache namevhosts problem

    Do you mean registering sub.domain.com with a dns registry? Did not think you had to do that with namevhosts

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: apache namevhosts problem

    It must resolve on all clients, not the server.

    Here's how namevhosts work:

    1. Web browser gets http://foo.example.com

    2. Resolves to IP address a.b.c.d

    3. Connects to a.b.c.d and sends the request including a line with Host: foo.example.com.

    4. Webserver sees that the request is intended for foo.example.com and uses the appropriate vhost. That Host: line makes all the difference.

    If the client cannot resolve the vhost domain name, it doesn't get past step 2.

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: apache namevhosts problem

    Quote Originally Posted by korvirlol View Post
    Do you mean registering sub.domain.com with a dns registry? Did not think you had to do that with namevhosts
    If that is what you have to do with for all the clients you are interested in, yes, you have to do it.

    If only a few internal clients use it and they are all Linux/Unix, and you can edit /etc/hosts on all of them, then that will work.

    If all the clients are internal and use an internal DNS server to resolve requests and you can control that DNS server, then you can add it there.

  9. #9

    Default Re: apache namevhosts problem

    but the domain is the same isnt it? krm-tech.com

    I cant register a domain like secure.krm-tech.com

    Sorry if im missing the point of your replies, trying to understand

  10. #10
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: apache namevhosts problem

    secure.krm-tech.com is also a domain name. When Internet technical people say domain name, they don't mean just the domain krm-tech.com. Every name which is registered is a domain name, e.g. secure.krm-tech.com, mail.krm-tech.com, www.krm-tech.com, and so forth.

    The confusion of a domain name with a domain is understandable.

    If you have a registrar for krm-tech.com, then it's likely they give you the facility to add more domain names to the domain, like mail.krm-tech.com, www.krm-tech.com.

Page 1 of 2 12 LastLast

Posting Permissions

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