LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-25-2009, 10:24 AM   #1
tibberous
Member
 
Registered: Oct 2004
Posts: 56

Rep: Reputation: 15
How can I make my server work with all domains pointed at it?


I want to have my server setup so that whenever a domain is pointed at it, it shows my website.

My server right now is running WHM / cpanel. It uses ns1.trenttompkins.com and ns2.trenttompkins.com.

In my httpd.conf, is this record:

# Default vhost for unbound IPs
<VirtualHost *>
ServerName server.trenttompkins.com
DocumentRoot /usr/local/apache/htdocs
ServerAdmin root@server.trenttompkins.com
UserDir disable
</VirtualHost>

So I would think I'd just be able to point a domain and have it work. However, when I point a random domain to the site, it doesn't work (Address not found error). I think this is because the nameserver needs to resolve miscellaneous domains to my main IP and it isn't.

Does anyone know how I can set this up?

Last edited by tibberous; 01-25-2009 at 10:28 AM. Reason: typo
 
Old 01-25-2009, 12:02 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
If I can understand well what you want to do, is to resolve any hostname to your ip address (and not any domain). This can be done using a wildcard hostname in your domain zone file:
Code:
*   IN   A   xx.xx.xx.xx
where xx.xx.xx.xx is your server's ip.
Then you must use the ServerAlias directive in apache vhost config:
Code:
<VirtualHost *>
ServerName server.trenttompkins.com
ServerAlias *.trenttompkins.com
DocumentRoot /usr/local/apache/htdocs
ServerAdmin root@server.trenttompkins.com
UserDir disable
</VirtualHost>
 
Old 01-25-2009, 12:26 PM   #3
tibberous
Member
 
Registered: Oct 2004
Posts: 56

Original Poster
Rep: Reputation: 15
Awesome! any idea where my domain file wold be?
 
Old 01-25-2009, 12:44 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
any idea where my domain file wold be?
I don't know where cpanel saves dns configuration files because I have never used it, but you can add the "*" A record the same way you added the "server.trenttompkins.com".
 
Old 01-25-2009, 03:17 PM   #5
tibberous
Member
 
Registered: Oct 2004
Posts: 56

Original Poster
Rep: Reputation: 15
Is this what I'm looking for?

Code:
trenttompkins.com.      86400   IN      NS      ns2.trenttompkins.com.
trenttompkins.com.      86400   IN      NS      ns1.trenttompkins.com.


trenttompkins.com.      14400   IN      A       72.29.86.135

localhost.trenttompkins.com.    14400   IN      A       127.0.0.1

trenttompkins.com.      14400   IN      MX      0       trenttompkins.com.

mail    14400   IN      CNAME   trenttompkins.com.
www     14400   IN      CNAME   trenttompkins.com.
ftp     14400   IN      A       72.29.86.135
ns1.trenttompkins.com.  14400   IN      A       72.29.86.135
ns2.trenttompkins.com.  14400   IN      A       72.29.86.136
 
Old 01-25-2009, 05:19 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Yes, that's the zone file for your domain. Don't forget to increase the serial once you add or edit a record.

Cheers
 
Old 01-25-2009, 08:16 PM   #7
tibberous
Member
 
Registered: Oct 2004
Posts: 56

Original Poster
Rep: Reputation: 15
Hmm...

I added

* IN A 72.29.86.138

But I don't think it did anything...

Am I missing something? How do I increase the serial?

Also, if it matters, it looks like I have a bunch of zones, each with a db file.

Code:
        zone "server.trenttompkins.com" {
                type master;
                file "/var/named/server.trenttompkins.com.db";
        };

        zone "trenttompkins.com" {
                type master;
                file "/var/named/trenttompkins.com.db";
        };

        zone "osflv.com" {
                type master;
                file "/var/named/osflv.com.db";
        };

        zone "flashgamereview.com" {
                type master;
                file "/var/named/flashgamereview.com.db";
        };
All in /etc/named.conf

Should I create a new zone somehow?
 
Old 01-25-2009, 08:57 PM   #8
tibberous
Member
 
Registered: Oct 2004
Posts: 56

Original Poster
Rep: Reputation: 15
=/

I tried:

*. 14400 IN A 72.29.86.135

and

* 14400 IN A 72.29.86.135

Still nothing.

This seems like something you'd generally want by default, I can't believe how hard it is to do.
 
Old 01-26-2009, 12:28 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
zone "server.trenttompkins.com" {
type master;
file "/var/named/server.trenttompkins.com.db";
};

zone "trenttompkins.com" {
type master;
file "/var/named/trenttompkins.com.db";
};
I don't understand why you have 2 zone files for trenttompkins.com and server.trenttompkins.com. You can have the A record for server.trenttompkins.com in /var/named/trenttompkins.com.db.
The serial number is the number in the 2nd/3rd line usually and must be increased every time you do a change. See the example bellow:
Quote:
$TTL 86400 ; 1 day
@ IN SOA example.com. hostmaster.example.com. (
2009012601 ; Serial YYYYMMDDXX
10800 ; Refresh
3600 ; Retry
3600000 ; Expire
86400 ) ; minimum
...
You must restart or reload the dns when you make a change. Of course I don't know how you can achieve this using the cpanel interface, so you should check the documentation.
Quote:
I tried:
*. 14400 IN A 72.29.86.135
and
* 14400 IN A 72.29.86.135
The correct syntax is any of the following:
Code:
*.trenttompkins.com. IN A 72.29.86.135
or
* IN A 72.29.86.135
 
  


Reply



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
Multiple domains in LDAP and 1 samba server for all domains, what to do? xnomad Linux - Server 1 11-14-2008 09:12 AM
How to make Dial in server work? bjvinny Linux - Networking 0 01-06-2008 08:49 PM
How to make DNS Server work with intranet with web site on Unbutu Server? explorer1979 Linux - Server 6 04-04-2007 10:50 AM
LXer: Server or Desktop: Can Linux Companies Make it Work? LXer Syndicated Linux News 0 11-08-2006 04:21 PM
Sub domains/How to make... raek Linux - Networking 4 08-05-2002 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:10 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
Open Source Consulting | Domain Registration