LAMP and MEAN stack on the same droplet

Posted March 10, 2014 6.8k 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.

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.

Submit an Answer
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: