Tutorial on LAMP and Nodejs setup?

June 1, 2017 869 views
LAMP Stack Node.js

Has anyone had any luck installing LAMP server then NodeJs? All my temps have fail with doing them both side by side.
Trying to get NodeJS to work on port 3000 or even load up on the URL. https://mysitedomain.com:3000/ always gives me a url error or page wont load up.
I have tryed the apache proxypass https and still it refuses to work.

3 Answers

@peopleandchat

I think that you should try to access your NodeJS app on this url http://mysitedomain.com/.

You are running apache as a reverse proxy and behind it you have your NodeJS app running on localhost that is why your url gives connection refused error.

Hope this helps, if it does not provide me with your apache configuration and the output of netstat -ltn | grep 3000 to make sure that your NodeJS app is running and the apache proxy is setup correctly.

@peopleandchat

When using Apache as a proxy to your NodeJS application, you should be proxying to the app on the IP and Port it's running on and then access your domain without the port attached.

The purpose of using a proxy setup is to prevent the port from being required in the URL.

...

If, when you access your domain without the port attached, it's still failing, please post the output of:

tail -20 /var/log/apache2/error.log

as well as your VirtualHost configuration so that we can take a look at it and see if there's anything that's causing it to fail.

To keep formatting in check, you can use the </> icon in the editor. That'll allow you to post each piece in a code block.

I started complately over and did the basic's with this guide. Then after it was all setup I added php,mysql and phpmyadmin with .htaccess.

But my big question now is how can I upload a none nodejs project? without effect the nodejs server.

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04

Node.js is an open source JavaScript runtime environment for easily building server-side and networking applications. Node.js applications can be run at the command line but this guide focuses on running them as a service using PM2, so that they will automatically restart on reboot or failure, and can safely be used in a production environment.
Have another answer? Share your knowledge.