我正在尝试设置我的php网站,这样它就可以与有聊天软件的node.js服务器通信。
在httpd.conf中,我应该添加如下内容:
<VirtualHost *:80>
ServerAdmin admin@[domain.tld]
DocumentRoot /var/www/html/[websitedir]
ServerName [domain.tld]
ServerAlias [domain.tld] *.[domain.tld]
Proxypass /chat http://localhost:8000
ProxyTimeout 310
</VirtualHost> Jus需要澄清的是,这应该放在我的PHP中,domain.tld应该是我的node.js服务器地址。对吗?还有,
ProxyPass /chat http://localhost:8000还应该包含我的node.js服务器而不是本地主机。另外,使用/chat/作为ProxyPass参数,myphpserver.com/chat将重定向到mynodeserver:8000。我说得对吗?
谢谢。
发布于 2013-09-10 05:09:49
这将不会重定向,它将创建一个反向代理。实际上,Apache将在客户端和节点服务器之间来回传递所有消息。
作为一种安全防范措施,您可能需要这样做:
ProxyPass /chat/ http://localhost:8000/
ProxyPassReverse /chat/ http://localhost:8000/不包括尾随斜杠会让您在任何以聊天开始的页面上出现代理错误.例如/chatrooms被代理到http://localhost:8000rooms
https://stackoverflow.com/questions/18710799
复制相似问题