简体   繁体   English

具有专用IP地址的网站仍使用共享服务器IP

[英]Website with dedicated IP Address, still uses shared server IP

Using cPanel WHM I have created a website hosting with Dedicated IP Address, 我使用cPanel WHM创建了一个托管有专用IP地址的网站,

I'm planning to use it with the IP Address instead of a domain (eg http://1.2.3.4/script.php ) 我打算将它与IP地址而不是域一起使用(例如http://1.2.3.4/script.php

It opens, script also works fine. 它打开,脚本也可以正常工作。

The only issue is the IP address it uses isn't dedicated, it still uses server's shared IP. 唯一的问题是它使用的IP地址不是专用的,它仍然使用服务器的共享IP。

I checked by CURL equivalent file_get_contents(' http://myip.is ') , the IP is the shared IP of server not the IP is use in URL or dedicated to it. 我通过CURL等效的file_get_contents(' http://myip.is ')进行了检查,该IP是服务器的共享IP,而不是该IP用于URL或专用于该IP。

After a lot of tries, I realized the issue is because of CURL, apparently it still uses the server's main IP Address. 经过大量尝试,我意识到问题是由于CURL,显然它仍然使用服务器的主IP地址。

I managed to fixed this by adding the following to my CURL function 我设法通过将以下内容添加到我的CURL函数中来解决此问题

// Changing 1.2.3.4 with websites real IP
$website_ip = '1.2.3.4';
curl_setopt($curl, CURLOPT_INTERFACE, $website_ip);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM