subdomain masking?

Discussion in 'General' started by eraser, Dec 25, 2007.

  1. eraser

    eraser New Member

    Howdy all,
    Now i know this has been asked a billion times and i looked through the previous posts on the subject, but i want a straight answer and fix.

    First thing i have a wildcard Aname dns entry to anythign.example.com resolves to my hosts ip.

    On previous webservers i have used if i typed; blah.example.com it would say blah.example.com in the address bar but on the backend would just look for the directory blah in the example.com and present that, if no directory was found normal 404 error would appear. And if you wanted blah.example.com/images the backend would be grabbing www/www.example.com/blah/images/.

    But as it stands right now blah.example.com is getting sent to the shared ip default page.

    I have tried googling this topic as well but i dont really understand what people call it, (virtual host subdomains?).

    Im sorry if i have skipped over this in the manual etc.

    Thanks in advance.
    -Marc
     
  2. Hans

    Hans Moderator Moderator

    Please do the following:
    - Within the DNS-records of your DNS-registar, make sure you have an A-record pointing to the public IP-address of your Internet connection.
    - Within the DNS-records of your DNS-registar, make sure you have a wild card cname (or at least thethe cname "blah") pointing to the domain "example.com".
    - Make sure that you use the internal IP-address of your server not your public IP-address when your server is behind a router.
    - Make sure that the document root within ISPConfig > Management > Settings > Web, has been set to /var/www.
    - When you create a subdomain, use "blah" for the hostname and "example.com" for the domain name.
     
    Last edited: Dec 25, 2007
  3. eraser

    eraser New Member

    Hi,
    Thanks for the quick response. I have done all this previously it it all working as it should be.

    - Within the DNS-records of your DNS-registar, make sure you have an A-record pointing to the public IP-address of your Internet connection.
    DONE
    - Within the DNS-records of your DNS-registar, make sure you have a wild card cname (or at least thethe cname "blah") pointing to the domain "example.com".
    DONE
    - Make sure that you use the internal IP-address of your server not your public IP-address when your server is behind a router.
    DONE
    - Make sure that the document root within ISPConfig > Management > Settings > Web, has been set to /var/www.
    DONE
    - When you create a subdomain, use "blah" for the hostname and "example.com" for the domain name

    Now this is the bit i am talking about, rather then creating a subdomain in ispconfig, to just do it automatically on request. (Modrewrite?)

    So i could in theory go to blah.example.com and have it work without actually needing to specify that is is a subdomain to ispconfig.

    If its not possible no big problem, just that a webhost i had a while back worked like that.

    Thanks again,
    -Marc
     
  4. falko

    falko Super Moderator Howtoforge Staff

    You'd have to modify the ServerAlias line in the example.com vhost, e.g. like this:
    Code:
     ServerAlias *.example.com
    Because the ServerAlias line is written by ISPConfig, you'd have to modify the make_vhost() function in /root/ispconfig/scripts/lib/config.lib.php.
     

Share This Page