简体   繁体   English

LAMP和Node.js在同一台服务器上

[英]LAMP and nodejs on the same server

I am having a PHP(Laravel Framework) application and a nodejs application. 我有一个PHP(Laravel框架)应用程序和一个nodejs应用程序。 The nodejs application is used for sending push notification to user browser in conjunction with socket.io .Since PHP is not a better solution for long polling process I had to include node.js application in to my stack. nodejs应用程序用于与socket.io一起向用户浏览器发送推送通知。由于PHP对于长轮询过程不是更好的解决方案,因此我必须将node.js应用程序包含在堆栈中。 I am using nodejs only for a single functionality (to show some real time data to a user who comes to my page ). 我仅将nodejs用于单个功能(向访问我页面的用户显示一些实时数据)。

I can expect a concurrent connection of 1000 , so I avoided using PHP for ajax long polling and used nodejs for handling long polling along with socket.io 我可以预期并发连接数为1000,因此避免使用PHP进行ajax长轮询,而避免使用nodejs与socket.io一起处理长轮询。

Now I am confused whether deploying my PHP application and nodejs application will cause any issues? 现在我很困惑,部署PHP应用程序和nodejs应用程序是否会引起任何问题? My PHP application will be communicating with nodejs app through internal APIs. 我的PHP应用程序将通过内部API与nodejs应用程序通信。

Is it fine to deploy nodejs on a LAMP stack in terms of performance? 就性能而言,将Node.js部署在LAMP堆栈上是否合适? Does the traffic hits (long polling) process on nodejs affects my server and there by affects my PHP application? nodejs上的流量命中(长时间轮询)过程是否会影响我的服务器,从而影响我的PHP应用程序?

No Problem having them on same server. 将它们放在同一服务器上没问题。 Just make sure the nodejs server isn't trying to bind on the same ports as the apache (ie. not 80/443) 只需确保nodejs服务器未尝试与apache绑定在相同的端口上即可(即,不是80/443)

Php and Nodejs application can be run at a single machine without any conflict.It will not affect your Php application performance. Php和Nodejs应用程序可以在同一台计算机上运行而不会发生任何冲突。它将不会影响您的Php应用程序性能。 Your Php application apache server will run on diffrent port and Nodejs will run on different port. 您的Php应用程序Apache服务器将在不同的端口上运行,而Nodejs将在不同的端口上运行。 But there is a way to set proxy in apache config to run node and php similar kind of actions. 但是有一种方法可以在apache config中设置代理以运行node和php类似的操作。

See this link to set proxy. 请参阅此链接来设置代理。

All your nodejs and Php url will look like below: 您所有的nodejs和Php网址如下所示:

http://localhost/node/ [All NodeJs actions]
http://localhost/normalPhpActions/ [All Php Actions]

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

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