简体   繁体   English

在具有SSL的服务器上使用Curl

[英]Using Curl on a server with SSL

My question is fairly straight-forward, but I will include some background information to flesh out the problem: 我的问题很简单,但是我将提供一些背景信息来充实问题:

I have a server in my office which runs software to create maps. 我办公室中有一台服务器,该服务器运行用于创建地图的软件。 These maps are updated with new information when people in my office enter data into an application. 当我办公室的人将数据输入应用程序时,这些地图将使用新信息进行更新。

I have a public website which shows these maps to users. 我有一个公共网站,向用户显示这些地图。 This website is hosted on a GoDaddy shared hosting plan. 该网站托管在GoDaddy共享托管计划中。 In order for the website to retrieve a map from my in-house server, I use CURL to send a request to the in-house server. 为了使网站从我的内部服务器中检索地图,我使用CURL向内部服务器发送请求。 The in-house server checks the IP of the calling server (as well as some other credentials) and then issues a key. 内部服务器检查呼叫服务器的IP(以及其他一些凭据),然后发出密钥。

This has always worked well. 这一直很好。 My website has always been hosted on a dedicated server, which had a static IP. 我的网站始终托管在具有静态IP的专用服务器上。 I recently moved the site to a shared plan. 我最近将网站移到了共享计划。 I was advised that the only way to have a static IP on this plans is to purchase an SSL certificate. 有人告诉我,在此计划上拥有静态IP的唯一方法是购买SSL证书。 Now my website is unable to authenticate at my in-house server. 现在,我的网站无法在内部服务器上进行身份验证。

I don't know much about SSL. 我对SSL不太了解。 GoDaddy tells me my static IP is one thing, but if I run a PHP command: ( echo $_SERVER['SERVER_ADDR']; ) on my hosted website I see a very different IP. GoDaddy告诉我,我的静态IP是一回事,但是如果我运行一个PHP命令:( echo $_SERVER['SERVER_ADDR']; )在托管网站上,我会看到一个非常不同的IP。

This leaves me wondering- 这让我想知道-

1. When I send a CURL request form this SSL certified server, what is the originating IP Address? 1.当我从此SSL认证服务器发送CURL请求时,原始IP地址是什么? Is there a way to check? 有没有办法检查?

2. Does a CURL request which originates on an SSL site need any special parameters? 2.源自SSL站点的CURL请求是否需要任何特殊参数? I have learned that a request which calls an SSL server must have special parameters. 我了解到, 调用 SSL服务器的请求必须具有特殊参数。 But this is not the case. 但这种情况并非如此。

Sorry for the long question. 对不起,很长的问题。 Any help would be appreciated. 任何帮助,将不胜感激。

This has always worked well. 这一直很好。 My website has always been hosted on a dedicated server, which had a static IP. 我的网站始终托管在具有静态IP的专用服务器上。 I recently moved the site to a shared plan. 我最近将网站移到了共享计划。 I was advised that the only way to have a static IP on this plans is to purchase an SSL certificate. 有人告诉我,在此计划上拥有静态IP的唯一方法是购买SSL证书。 Now my website is unable to authenticate at my in-house server. 现在,我的网站无法在内部服务器上进行身份验证。

I think you misunderstood. 我想你误会了。 Your IP address will still be static, but there will be multiple web servers on the same IP, that is you have a static but not a dedicated IP address. 您的IP地址仍将是静态的,但是同一IP上将有多个Web服务器,即您具有静态的IP地址,但没有专用的IP地址。 And it might also change from time to time when the provider decides to move sites between servers to balance the load. 当提供商决定在服务器之间移动站点以平衡负载时,它可能还会不时更改。

The reason you get a dedicated IP address with SSL only comes from the fact, that IP addresses are a scare resource so you need a good reason to get one dedicated for your own. 使用SSL获得专用IP地址的原因仅来自于以下事实:IP地址是一种稀缺资源,因此您需要一个充分的理由来为自己的IP地址分配专用地址。 An SSL certificate is a real reason because traditionally you could only have a single certificate per IP address. SSL证书是真正的原因,因为传统上每个IP地址只能有一个证书。 This is no longer necessary for modern browsers which support the SSL SNI extension, but some applications still need it. 对于支持SSL SNI扩展的现代浏览器,这不再是必需的,但是某些应用程序仍然需要它。

  1. When I send a CURL request form this SSL certified server, what is the originating IP Address? 当我从此SSL认证服务器发送CURL请求时,原始IP地址是什么? Is there a way to check? 有没有办法检查?

Usually such a server has multiple IP addresses and there might be IPs added and removed while the server is running (if web sites are added/removed). 通常,这样的服务器具有多个IP地址,并且在服务器运行时可能会添加和删除IP(如果添加/删除了网站)。 So you cannot be sure about a specific IP you have as source IP for the connection from curl. 因此,您无法确定特定的IP作为来自curl的连接的源IP。 At most you can check for a specific network. 最多只能检查一个特定的网络。

  1. Does a CURL request which originates on an SSL site need any special parameters? 源自SSL站点的CURL请求是否需要任何特殊参数? I have learned that a request which calls an SSL server must have special parameters. 我了解到,调用SSL服务器的请求必须具有特殊参数。 But this is not the case. 但这种情况并非如此。

The SSL-enabled web server is one software at the server. 启用S​​SL的Web服务器是该服务器上的一种软件。 curl is another software. curl是另一个软件。 Configuration of the web server does not affect how you have to use curl with an unrelated site. Web服务器的配置不会影响对无关站点使用curl的方式。

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

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