Nginx – Running PHP and Node.js on the same Nginx server

nginxnode.jsPHPphp-fpmUbuntu

is it possible to run PHP and Node.js on the same Nginx Server and VPS? I already manage to make nginx as reverse proxy for node.js but my question is how to run it alongside with PHP?

I want node.js to run on the subdomain let say node.mydomain.com while my PHP application runs on mydomain.com.

Best Answer

Take a look at this post: http://bergie.iki.fi/blog/dnode-make_php_and_node-js_talk_to_each_other/

You could make a simple communicating script on node.mydomain.com and have the NodeJS server listen on another port.

Else you can also proxy_redirect http://node.mydomain.com http://mydomain:8080/; so here you have to run the NodeJS on another port, too.

Related Topic