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.


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.

  • Thanks! I'm going to try this now on my DigitalOcean VPS. – Port 8080 Jan 10 '15 at 15:51
  • Good luck dude :) – Cr41s3 Jan 10 '15 at 16:05
  • Thanks. I just did it. I created a virtual host both for PHP and Node.js. Then I just added proxy_pass http://localhost:3000 to my Node.js virtual host configuration. It is now accessible. – Port 8080 Jan 10 '15 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.