#1 (permalink)  
Old 05-27-2006, 02:45 PM
Registered User
 
Join Date: Feb 2004
Posts: 19
Celtic Mad
Multiple IPs per domain

I have 6 IPs and was wondering can I have the other 5 redirect to my site so when someone puts in any of the 6 IPs they come to my website?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-27-2006, 06:16 PM
dave9000's Avatar
Registered User
 
Join Date: Apr 2003
Location: arkansas
Posts: 889
dave9000 is an unknown quantity at this point
Sure you can. Its going to have to be done manually but it can be done. Apache will always default to the first entry for a ip address if it does not find a valid virtual host entry so therefor just add 5 entries to the httpd.conf 1 for each address and set the path to the web you wish to display.

NameVirtualHost 1.1.1.2
<VirtualHost 1.1.1.2>
DocumentRoot /path to web
</VirtualHost>

NameVirtualHost 1.1.1.3
<VirtualHost 1.1.1.3>
DocumentRoot /path to web
</VirtualHost>

etc

Add additional entries to the VirtualHost container according to your needs
__________________
Dave Browning
Intersite Technologies
Greenbrier Ar
dave@isitetech.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-27-2006, 06:22 PM
Registered User
 
Join Date: Feb 2004
Posts: 19
Celtic Mad
Thanks,

What would I put in 'DocumentRoot /path to web'?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-27-2006, 06:25 PM
dave9000's Avatar
Registered User
 
Join Date: Apr 2003
Location: arkansas
Posts: 889
dave9000 is an unknown quantity at this point
The actual file path to the website you wish to come up when they access that ip

as in

DocumentRoot /home/foo/public_html
__________________
Dave Browning
Intersite Technologies
Greenbrier Ar
dave@isitetech.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-27-2006, 06:28 PM
Registered User
 
Join Date: Feb 2004
Posts: 19
Celtic Mad
Quote:
Originally Posted by dave9000
The actual file path to the website you wish to come up when they access that ip

as in

DocumentRoot /home/foo/public_html
ok thanks, I have added them into httpd.conf

Does it take a while to resolve?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-27-2006, 06:29 PM
dave9000's Avatar
Registered User
 
Join Date: Apr 2003
Location: arkansas
Posts: 889
dave9000 is an unknown quantity at this point
It should be instant once you restart apache

make sure you have the ips active on the server
__________________
Dave Browning
Intersite Technologies
Greenbrier Ar
dave@isitetech.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-27-2006, 06:36 PM
Registered User
 
Join Date: Feb 2004
Posts: 19
Celtic Mad
Works like a charm. thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-27-2006, 07:01 PM
dave9000's Avatar
Registered User
 
Join Date: Apr 2003
Location: arkansas
Posts: 889
dave9000 is an unknown quantity at this point
your welcome
__________________
Dave Browning
Intersite Technologies
Greenbrier Ar
dave@isitetech.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-28-2006, 11:17 AM
chirpy's Avatar
Moderator
 
Join Date: Jun 2002
Location: Go on, have a guess
Posts: 13,495
chirpy will become famous soon enough
Quote:
Originally Posted by dave9000
Sure you can. Its going to have to be done manually but it can be done. Apache will always default to the first entry for a ip address if it does not find a valid virtual host entry so therefor just add 5 entries to the httpd.conf 1 for each address and set the path to the web you wish to display.

NameVirtualHost 1.1.1.2
<VirtualHost 1.1.1.2>
DocumentRoot /path to web
</VirtualHost>

NameVirtualHost 1.1.1.3
<VirtualHost 1.1.1.3>
DocumentRoot /path to web
</VirtualHost>

etc

Add additional entries to the VirtualHost container according to your needs
You can actually simplify that if they're all going to the same place by listing all the IP addresses in the one VirtualHost container of the main site:

<VirtualHost 1.1.1.2 1.1.1.3 1.1.1.4>

__________________
Jonathan Michaelson
cPanel Forum Moderator

Need your cPanel servers secured and tuned?
cPanel Server Configuration, Security, Recovery and Antivirus/AntiSpam Services
Developers of the most effective (and free) Firewall & Security Solution for cPanel Servers - csf
http://www.configserver.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 01-15-2009, 05:13 PM
Registered User
 
Join Date: Jun 2008
Posts: 7
computica is on a distinguished road
Hate to dig up an old thread but I'm looking at this a couple years later and wondering if anything has changed with the procedure. We are running WHM/Cpanel and when viewing the httpd.conf it shows that these lines should not be edited and that an include file should be used instead.

To give a little background, we are looking into getting some redundancy for our server's internet connection and need to know how to setup the WHM/Cpanel server itself to accept traffic on both the primary and the secondary (failover) IP addresses. We will be using dnsmadeeasy to handle the DNS part of the equation, we just need to make sure the server is ready to accept the traffic once people are directed to the new IP.

In short, what needs to be done to set this up to work properly on our WHM/CPanel server?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 06-17-2009, 05:20 PM
Registered User
 
Join Date: Jun 2008
Posts: 7
computica is on a distinguished road
Quote:
Originally Posted by computica View Post
Hate to dig up an old thread but I'm looking at this a couple years later and wondering if anything has changed with the procedure. We are running WHM/Cpanel and when viewing the httpd.conf it shows that these lines should not be edited and that an include file should be used instead.

To give a little background, we are looking into getting some redundancy for our server's internet connection and need to know how to setup the WHM/Cpanel server itself to accept traffic on both the primary and the secondary (failover) IP addresses. We will be using dnsmadeeasy to handle the DNS part of the equation, we just need to make sure the server is ready to accept the traffic once people are directed to the new IP.

In short, what needs to be done to set this up to work properly on our WHM/CPanel server?
Resurrecting once again since we are looking once more into setting this up. We need cPanel to accept web traffic (and preferably also mail traffic) FROM more than one IP TO a single cPanel account.

Thanks for any pointers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 06-17-2009, 05:38 PM
Spiral's Avatar
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
The configuration part really has not changed and remains the same as
it was back when this thread originally began despite the current use
of include files.

You would need to expand the virtualhost container to include the new IPs
and then of course update your DNS zone files to also resolve the new IPs.

Now if this is all on one server with a single network interface running
multiple IPs, there is no real tactical advantage to doing this and it
won't do anything in terms of "load balance" or "failover" because you
are running off of the same physical machine so one down is all down.

If you are dealing with multiple physical network interfaces, that might
be a different issue but again limited if you are running the same server
as would be the case for this sort of configuration.

To have any kind of real "failover" type configuration for multiple IPs,
those IPs would actually be on different servers and the DNS would be
setup to load balance between the multiple servers running mirrored
accounts between each other each on their own IP but with the
same domain address.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 06-17-2009, 06:36 PM
Registered User
 
Join Date: Jun 2008
Posts: 7
computica is on a distinguished road
Quote:
Originally Posted by Spiral View Post
The configuration part really has not changed and remains the same as
it was back when this thread originally began despite the current use
of include files.

You would need to expand the virtualhost container to include the new IPs
and then of course update your DNS zone files to also resolve the new IPs.

Now if this is all on one server with a single network interface running
multiple IPs, there is no real tactical advantage to doing this and it
won't do anything in terms of "load balance" or "failover" because you
are running off of the same physical machine so one down is all down.

If you are dealing with multiple physical network interfaces, that might
be a different issue but again limited if you are running the same server
as would be the case for this sort of configuration.

To have any kind of real "failover" type configuration for multiple IPs,
those IPs would actually be on different servers and the DNS would be
setup to load balance between the multiple servers running mirrored
accounts between each other each on their own IP but with the
same domain address.
Thanks for the reply. We aren't looking for traditional "failover" in terms of the server itself, just in terms of the internet connection to the server. Web hosting is not our primary business and we maintain our own server with about 30 sites located our office. Our primary connection is via Cable which isn't 100% reliable, so our main concern is having a backup connection (DSL most likely) that will allow the sites/email to remain live while whatever issues with the primary connection are resolved.

The server itself is virtualized and we have multiple backups, so we're not too concerned with redundancy in that department. Load balancing is also not an issue since we have a lot more power than what is required for the small amount of sites we host.

Could you possibly point me in the proper direction in terms of setting up the include files to make this possible?

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 06-17-2009, 08:13 PM
Spiral's Avatar
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
Cool

You could put the directives in the pre_virtualhost_global.conf file
located at /usr/local/apache/conf/includes if you are looking to make
modifications to all sites.

You could theoretically add a new conf file to the virtualhost custom
configuration path for each domain but I suspect this probably won't
work as Apache goes with the first directive it sees and in this case
would be that of loading the single IP address but in any case, the
location to add custom virtualhost config files is at:
Code:
/usr/local/apache/conf/userdata/std/2/(login)/(domainname)
Alternatively, if you have specific sites you want to expand the IP address,
you could duplicate the virtualhost section for those accounts but instead
label them under the new IP address(es) in their own new virtualhost
sections and put that code in the following file:
Code:
/usr/local/apache/conf/includes/post_virtualhost_global.conf
Any changes you make, it's probably good to go ahead and run the
update script for Cpanel's apache handling so that it knows about
the changes that you have made afterwards:
Code:
/usr/local/cpanel/bin/build_apache_conf
Now if you are wanting to do this for all sites, I myself would probably
just update the main virtualhost template and add the extra IP addresses
to the virtualhost section in the base template:
Code:
/var/cpanel/templates/apache2/vhost.default
Perhaps take the following ...
Code:
<VirtualHost[% FOREACH ipblock IN vhost.ips %] [% ipblock.ip %]:[% ipblock.port %][% END %]>
And change it to something like ...
Code:
<VirtualHost[% FOREACH ipblock IN vhost.ips %] [% ipblock.ip %]:[% ipblock.port %][% END %] x.x.x.x:80 y.y.y.y:80 z.z.z.z:80>
Theoretically, you would still need to add the respective NameVirtualHost
command in the main httpd.conf but since Cpanel uses a wildcard entry
as the last entry, this might not be totally necessary.

If you try the later approach updating the templates, don't forget to
rebuild your apache configuration afterwards for those changes to
take effect and then restart you Apache server process either way.

Hope that helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:33 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© cPanel Inc