Question

ehcp apache wildcard subdomain setup

Asked by: ussher

I have a local server that uses ehcp (easy hosting control panel (http://ehcp.net/) ) and want all subdomains to point to the root domain.  *.domainname.com goes to domainname.com

whatever.domainname.com
anything.domainname.com
something.domainname.com
random.domainname.com

all redirect to domain.com

this is the directions set out by the module http://drupal.org/project/subdomain  but i cant get passed this step.

"STEP 3: Enable wildcard DNS on your DNS hosting provider (e.g. *.example.com)"

help please.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-10-20 at 00:13:40ID24825980
Tags

apache

,

wildcard

,

subdomains

,

dns

,

mod rewrite

Topics

Apache Web Server

,

Domain Name Service (DNS)

Participating Experts
1
Points
500
Comments
24

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Subdomains
    I'm running one windows 2000 machine for my webserver. My setup looks like this: Internet to router - router forward port 80 & 21 to 192.168.0.4 (windows 2000 server). I want to be able to host subdomains. I'm going to buy my domain and have it point to my router's ip....
  2. Wildcard subdomain
    Hi, I want to install WP MU on my server (Centos 5, PHP 5, Apache 2.0.63), and I need to setup wildcard subdomain. But I want to reserve subdomain blabla.domain.com for my own use, and server can use the rest. How to do that?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Chris-DentPosted on 2009-10-20 at 02:13:46ID: 25612139


Kind of difficult to help without knowing what difficulty you're having with it.

The record normally looks like this:

*   IN A   WhatEverIPAddress

I couldn't tell you how to add that without knowing what DNS system we're dealing with.

Chris

 

by: ussherPosted on 2009-10-20 at 02:19:27ID: 25612173

Hi Chris.

I am using the ehcp control panel system so it did most of the setup for me.  what i have sofar that i think is heading in the right direction is:

in the apache2.conf file i have added
ServerAlias *.mydomainname.com

and in the 'custom DNS' area of ehcp i have added this record:
*.{domainname}. IN A {webip}

and also
*.{domainname}. IN CNAME {domainname}.

the URL www.mydomainname.com is what im trying to achieve for any random keyword that is used.

right now www.mydomainname.com and mydomainname.com display the same webpage.

I want
xxxx.mydomainname.com
somethingxxxx.mydomainname.com
anything.mydomainname.com

to also work in the same fashion.  This is the requirement for the drupal subdomain module im trying to install.  (http://drupal.org/project/subdomain)

does that help? what other info should i provide?  thanks for your help

 

by: Chris-DentPosted on 2009-10-20 at 02:23:39ID: 25612198


The first is correct.

However, this one isn't legal while you have the A record version present, and it has somewhat unreliable support so I recommend you remove it:

> and also
> *.{domainname}. IN CNAME {domainname}.

Once you've got rid of it, try "nslookup somethingxxx.mydomainname.com" again.

Chris

 

by: ussherPosted on 2009-10-20 at 02:24:53ID: 25612208

this is the DNS template.  I have also added the custom dns of:
*.{domainname}. IN A {webip}

and
*.{domainname}. IN CNAME {domainname}.

$TTL    86400
@       IN      SOA     ns.{domainname}. {dnsemail} (
                        {serial}     ; Serial
                        10800   ; Refresh
                        3600    ; Retry
                        604800  ; Expire
                        86400 ) ; Minimum
 
{domainname}.           IN NS   ns.{domainname}.
ns.{domainname}.        IN A    {dnsip}
ns1.{domainname}.       IN A    {dnsip}
ns2.{domainname}.       IN A    {dnsip}
dns.{domainname}.       IN A    {dnsip}
dns1.{domainname}.       IN A    {dnsip}
dns2.{domainname}.       IN A    {dnsip}
{domainname}.           IN A    {webip}
mail.{domainname}.      IN A    {mailip}
smtp.{domainname}.   IN A    {webip}
webmail.{domainname}.   IN A    {webip}
ftp.{domainname}.       IN CNAME        {domainname}.
www.{domainname}.       IN CNAME        {domainname}.
{domainname}.           IN MX  10 mail.{domainname}.
*                       IN A    {webip}
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:

Select allOpen in new window

 

by: ussherPosted on 2009-10-20 at 02:26:41ID: 25612221

the http template looks like the attached snipit.

i have added this to the custom http:
ServerAlias *.mydomainname.com

#____________start of {domainname}__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
# explanation  {aciklama}
# Namevirtualhost *:80
# <VirtualHost *:80>
 
<VirtualHost *>
        ServerName   {domainname}
        ServerAlias  www.{domainname}
        UseCanonicalName Off
        DocumentRoot {homedir}/httpdocs
        
        # this combined log format is understandable by webalizer... some other formats are not recognised by webalizer.. thats why, specified here explicitly.. 
        
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
		LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
	    CustomLog  {homedir}/logs/access_log combined
	    CustomLog  /var/log/apache_common_access_log vhost_combined
	    
	    php_admin_value open_basedir {homedir}
	    php_admin_value upload_tmp_dir {homedir}/phptmpdir
		php_admin_value session.save_path {homedir}/phptmpdir
 
        AccessFileName .htaccess
	    
 
{customhttp}
 
</VirtualHost>
 
<VirtualHost *>
ServerAlias  webmail.{domainname}
DocumentRoot /var/www/vhosts/ehcp/webmail
 
        LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
		LogFormat "%v:%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
	    CustomLog  {homedir}/logs/access_log combined
	    CustomLog  /var/log/apache_common_access_log vhost_combined
 
php_admin_value open_basedir /var/www/vhosts/ehcp/webmail
php_admin_value upload_tmp_dir /var/www/vhosts/ehcp/webmail/data
php_admin_value session.save_path /var/www/vhosts/ehcp/webmail/data
 
</VirtualHost>
 
 
#____________end of {domainname}__paneluser:{panelusername}_reseller:{reseller}_id:{id}____________
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:

Select allOpen in new window

 

by: ussherPosted on 2009-10-20 at 02:31:18ID: 25612252

ok, got rid of the CNAME  and tried nslookup xxx.mydomainname.com which replied:

** server can't find xxx.mydomainname.com: NXDOMAIN

so i tried nslookup mydomainname.com and it gave me:

Server:         192.168.11.1
Address:        192.168.11.1#53

Non-authoritative answer:
Name:   mydomainname.com
Address: 174.36.129.80

the 174.36.129.80 is my online hosting company, not the local server.

 

by: Chris-DentPosted on 2009-10-20 at 02:44:23ID: 25612333


Try:

nslookup something.mydomainname.com ns.{domainname}

Replace the domain name with the correct values, and it should direct the query for "something.mydomainname.com" at the server "ns.{domainname}". If it still fails to respond and you have only the A record version of the wildcard you will need to raise the issue with your host, it's entirely possible they don't support wildcards.

Chris

 

by: ussherPosted on 2009-10-20 at 03:08:23ID: 25612470

I wish i could, but im the host.  the server is on virtualbox and my main desktop os is ubuntu.  the virtual server is ubuntu server.

on my desktop /etc/hosts has the record:
192.168.56.3 mydomainname.com

in it so when i access mydomainname.com from firefox i get the virtualbox server version of it rather than the internet version.

but if i do a
nslookup mydomainname.com from my desktop it points to the online version not the development version.

if i look at mydomainname.com in a browser i see the development site, but if i do nslookup mydomainname.com it points to the online site.

 

by: Chris-DentPosted on 2009-10-20 at 03:27:25ID: 25612571


> nslookup mydomainname.com from my desktop it points to the online version not the development version.

NsLookup ignores hosts, so that's to be expected, it's a tool for testing DNS servers rather than something to test the client resolvver.

Does the name server refuse to honour the wildcard? Even after you deleted the CNAME version?

Chris

 

by: ussherPosted on 2009-10-20 at 03:47:53ID: 25612684

I half expected you to give up after that issue.  thanks.

I removed the CNAME then restarted apache.  www.mydomainname.com is working (as it always did) but there is no change when i look at something.mydomain.com  the response from the browser is:
Firefox can't find the server at something.mydomainname.com

could it have anything to do with the order that the entries in DNS and HTTP template are in?

 

by: Chris-DentPosted on 2009-10-20 at 03:50:17ID: 25612701


Nope, as long as the zone loads each will be processed. Stick with nslookup because until that works there's no point in adding the web server into the mix.

Does your interface just act as a layer on top of BIND? Can we have a look at named.conf and the zone file for this zone?

Chris

 

by: ussherPosted on 2009-10-20 at 04:00:24ID: 25612764

in /etc/bind/mydomainname.com is the attached code snippit

does that help?

$TTL    86400
@       IN      SOA     ns.mydomainname.com. your.email.here (
                        864     ; Serial
                        10800   ; Refresh
                        3600    ; Retry
                        604800  ; Expire
                        86400 ) ; Minimum
 
mydomainname.com.           IN NS   ns.mydomainname.com.
ns.mydomainname.com.        IN A    192.168.56.3
ns1.mydomainname.com.       IN A    192.168.56.3
ns2.mydomainname.com.       IN A    192.168.56.3
dns.mydomainname.com.       IN A    192.168.56.3
dns1.mydomainname.com.       IN A    192.168.56.3
dns2.mydomainname.com.       IN A    192.168.56.3
mydomainname.com.           IN A    192.168.56.3
mail.mydomainname.com.      IN A    192.168.56.3
smtp.mydomainname.com.   IN A    192.168.56.3
webmail.mydomainname.com.   IN A    192.168.56.3
ftp.mydomainname.com.       IN CNAME        mydomainname.com.
www.mydomainname.com.       IN CNAME        mydomainname.com.
mydomainname.com.           IN MX  10 mail.mydomainname.com.
*.mydomainname.com. IN A 192.168.56.3
*                       IN A    192.168.56.3

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:

Select allOpen in new window

 

by: ussherPosted on 2009-10-20 at 04:11:45ID: 25612836

in /etc/named.conf was the include
iinclude "/etc/bind/named_ehcp.conf";

and inside /etc/bind/named_ehcp.conf  was:

zone "mydomainname.com" {
        type master;
        file "/etc/bind/mydomainname.com";
};

so thats why i pasted the above.  hope its useful.

 

by: ussherPosted on 2009-10-20 at 04:17:41ID: 25612867

this is the contents of /etc/bind/named.conf

// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
 
include "/etc/bind/named.conf.options";
 
// prime the server with knowledge of the root servers
zone "." {
        type hint;
        file "/etc/bind/db.root";
};
 
// be authoritative for the localhost forward and reverse zones, and for
// broadcast zones as per RFC 1912
 
zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};
 
zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};
zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};
 
zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};
 
include "/etc/bind/named.conf.local";
include "/etc/bind/named_ehcp.conf";
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:

Select allOpen in new window

 

by: Chris-DentPosted on 2009-10-20 at 04:25:32ID: 25612905


What's in this one please?

/etc/bind/named.conf.options

Can you see both of these two in the GUI?

*.mydomainname.com. IN A 192.168.56.3
*                       IN A    192.168.56.3

You only need the one, especially if they're pointing to the same IP.

Chris

 

by: ussherPosted on 2009-10-20 at 04:29:33ID: 25612917

guilty.  I put the first one into the gui template file as  *.{domainname}. IN A {webip}  Ill go take it out.

attached is the /etc/bind/named.conf.options file

options {
directory "/var/cache/bind";
 
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk.  See http://www.kb.cert.org/vuls/id/800113
 
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
 
// forwarders {
//      0.0.0.0;
// };
 
auth-nxdomain no;    # conform to RFC1035
listen-on-v6 { any; };
};
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:

Select allOpen in new window

 

by: Chris-DentPosted on 2009-10-20 at 04:33:37ID: 25612945


Likes to spread itself around doesn't it? :)

How about these two? Kind of expected an Options section with rather more in it than the above.

include "/etc/bind/named.conf.local";
include "/etc/bind/named_ehcp.conf";

Cheers!

Chris

 

by: ussherPosted on 2009-10-20 at 04:48:06ID: 25613023

thanks for sticking with this. really appreciated.
include "/etc/bind/named.conf.local";
// had nothing but comments in the file
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";


is attached below:
include "/etc/bind/named_ehcp.conf";

there is one entry like this for every domain on the development server. There are no other comments or settings in this file.

/*
domain id:72
domainname:mydomainname.com
panelusername:admin
reseller:admin
aciklama-explanation:{aciklama}
*/
zone "mydomainname.com" {
        type master;
        file "/etc/bind/mydomainname.com";
};

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:

Select allOpen in new window

 

by: ussherPosted on 2009-10-20 at 04:59:16ID: 25613097

ooh, i think i have found somthing important.  I went to the internet site and created a subdomain test.mydomainname.com

then accessed it from my desktop that will show the development environment when i look at a through Firefox at mydomainname.com but when i look through the browser at test.mydomainname.com then i see the online version.

The desktop is not going to the development environment for subdomains, only the main domain.  I think i need to add something to my /etc/hosts on the desktop to make it look at the development machine for all the subdomains too.

 

by: Chris-DentPosted on 2009-10-20 at 05:00:43ID: 25613104


There's no wildcards for Hosts, so you'd have to add each explicit name you wanted to use with the Dev system I'm afraid.

Chris

 

by: ussherPosted on 2009-10-20 at 05:06:36ID: 25613147

ah because that looks like its working now.  I just added
192.168.56.3 test.mydomainname.com  

to /etc/hosts and it went to the intended location.

oh well, for testing that will have to do. Thank you so much for your help and your time.

really appreciated.

 

by: Chris-DentPosted on 2009-10-20 at 05:07:27ID: 25613155


Any time :)

The wildcard is working for the main site then?

Chris

 

by: ussherPosted on 2009-10-20 at 05:13:02ID: 25613185

if the subdomain is added to /etc/hosts then the desktop knows to go to the development environment.  

when the site is accessed through the url with a subdomain on the development environment the correct script picks this up and tries to deliver content (that the purpose of the module)

currently its still a 404 on the content but now its formatted in the sites 404 page so i think its a content issue now and ill go about fixing that up tomorrow.

Much better than i had before you started helping me.  Ill tackle that issue tomorrow, late here now.

Thanks again.  You deserve the Genius tag.

 

by: ussherPosted on 2009-10-20 at 05:17:38ID: 31643262

Exceptional.  My setup of a development server on a virtualbox using ehcp caused is difficult enough to explain whats going on, let alone try to figure out how to fix issues with it.  I really appreciate Chris's patience and expert advice.  Your awesome!! thanks.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...