Is it possible to run a PHP website and a Node.js app on the same server?

  • Posted March 1, 2014

I have some old websites that are either running on Wordpress or otherwise using PHP that I would like to start migrating over to DigitalOcean soon. I would like to run this on a LEMP stack. I will also be building some Node.js apps in the near future.

I am coming from shared hosting so I am still learning how to manage my own server. Is it possible to run both my PHP websites and Node.js apps on the same server or would they need to be separate? If it is possible, can someone point me in the right direction on how it would be done?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can use a frontend proxy, like haproxy or nginx or (if you prefer to change stuff on the fly) use Dotcloud Hipache. Then you run multiple webservers on multiple ports and do name-based virtual hosts ( is on one webserver and on the other).

I’d sure love to know how to setup NodeJS and SocketIO along with a default LEMP install.

I would really like to know this as well.

You can have both without problem. I am doing it myself (my site is PHP) and my blog is nodeJS (ghost). <br>@bahit.hamid IMO it really depends of the tyoe of sites your are hosting. Its definetely more secure to have one user per site, mostly if your users have access to the server via FTP or something. If you are the only user with server access I think you can run all sites with the same user.

I’m in the same situation at the moment. Migrating from a shared hosting to DigitalOcean. <br> <br>I’ve done so far: <br>- Create Droplet (CentOS instead of Ubuntu) <br>- Installed LEMP (Using the tutorials found here) <br> <br>Now I want to try setting up Nginx to have ‘Virtual host’ for different website. Currently stuck with deciding setting up different users for best practice rather than using root when setting up everything. <br> <br>What is your user setup? Did you just created an alternative root user with the same permission as group as root? <br>