LAMP and MEAN stack on the same droplet

March 10, 2014 4.2k views
Is there a good tool (or a tutorial you would recommend) for installing a LAMP and MEAN stack on the same droplet? I have a number of very low traffic sites that run on Wordpress, and one that I'm developing on a MEAN stack. For a start I'd like to just try and run them all from a $5 droplet.
2 Answers
You can probably achieve this my setting up your servers on different ports and serving them up separately using a proxy with nginx or something similar that serves on port 80. Or maybe make your different applications/sites serve to a socket and picking them up with a nginx proxy (sorry, I use nginx a lot and I am unsure if this can be done with apache as well)
I would also recommend nginx to serve all of your requests, with server_name blocks for different sites.

For MEAN, you just proxy to your node port, i.e. 3000.

For LAMP, you have 2 options, either go the easy route and proxy your requests to an apache instance (start it on port 8080 for example). Or go the slightly more head-scratching and googling option, install php-fpm and proxy nginx requests directly to it. It's slightly more work, but you'll feel better about yourself ;-)

Either way, there are tutorials for both. I found this one helpful when setting up a wordpress site on my droplet, using nginx, without apache:
Have another answer? Share your knowledge.