简体   繁体   中英

Can i use Node js, Websocket and php in the same apache server?

I was wondering if its possible create a website combined with NodeJs, Websocket and php in the same Apache server. Is there any documentation that can i read?

"In the same Apache server", No. node.js does not run in Apache. It runs by itself.

But, you can use multiple technologies on the same server. For starters, you could have two completely separate web servers running on separate ports, one that was Apache + PHP + webSocket and another that was node.js + webSocket.

But, node.js does not use Apache. Instead, node.js would typically be configured to be it's own web server all by itself. So, you don't typically run an Apache server and have some requests through it go to PHP and some go to node.js.

Using PHP and node.js together depends entirely upon what you're trying to do with them. You could have your web server as a node.js server and then have some requests that node.js receives actually execute some PHP and get the results from running a PHP script. And, you could do the reverse too with a PHP script fielding the request and then manually running a node.js script for some requests.

To answer any more fully, we need to know what you're really trying to do with PHP, node.js and webSockets.

FYI, you could set up an NGINX proxy on port 80 and configure it to direct some requests to your Apache/PHP server (running on a different port) and other requests to your node.js server (running on a different port). Incoming webSocket requests would then be directed to one of the two servers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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