设置是:两个应用程序托管在同一个linux服务器上,使用apache配置中的vhost条目。说:
http://greatapp.example.com
和
http://superapp.example.com
它们都具有向第三个url发出服务器端http请求的功能(使用php cURL / file_get_contents):
http://apis.example.com
现在主机文件‘/etc/ host’中有一个主机条目
xx.xx.xx.xx apis.example.com这只适用于greatapp.example.com代码,而不是针对superapp.example.com。
如何配置服务器,使greatapps.example.com使用主机条目,但superapp.example.com使用apis.example.com的公共ip
发布于 2012-02-20 06:55:21
不能直接这样做:主机名空间是每个主机的全局空间。
您可以使用不同的/etc/hosts文件在虚拟机中运行其中一个apaches。
发布于 2012-02-20 07:16:34
我会这样做:
设置
urls.third_party =‘xxx.xxx’
这是一个给超级应用程序的
设置
urls.third_party = 'http://apis.example.com‘
2.使用Zend_Config_Ini从配置文件中读取url,例如:
require_once 'Zend/Config/Ini.php';
$config = new Zend_Config_Ini('application.ini', 'settings');
$app_config = $config->toArray();
$third_party_url = $app_config['urls']['third_party'];我认为您这样更灵活,因为您可以轻松地更改应用程序配置文件中的url。
https://stackoverflow.com/questions/9357236
复制相似问题