So I buy Dedicated Server and provider say I have 4 usable IPs. Lets say this are ip1, ip2...ip4 , so I want to set my Dedicated Server to run multiple domains on this IPs, example domain1 on ip1... I did this with no problem, now I want that when I run php script on domain1/script.php when this script fetches data(file_get_contents()) from whatismyip.com(just for example) whatismyip.com shows ip1, and when I run on domain2 it shows ip2,etc. So this means every domain has its own separate external IP, I need help how to set this on linux(CentOS) based server. I know is possible, VPS is example how this works, but I want to know where is the solution, do I need custom linux script started from PHP code, or apache config or third option? Please help me if you know solution. Thank you in advance.
migrated from stackoverflow.com May 18 '11 at 0:31
This question came from our site for professional and enthusiast programmers.
|
If you are specifically using
This will let you control which IP is used for the outbound connection. EDIT: see http://www.php.net/manual/en/context.socket.php for more detail. | |||
|
feedback
|
|
1) You need to register the domains to point to the IP addresses you want with your DNS provider: host1.com -> 10.1.1.1 host2.com -> 10.1.1.2 host3.com -> 10.1.1.3 host4.com -> 10.1.1.4 2) Try to create virtual hosts in apache like this: but create one virtual host entry for every IP so that you end up with 4 virtual hosts.
| |||
|
feedback
|