Hello this is my first time working with a VPS. I’ve managed to follow the instructions from this tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04 but once I reached the “Manage Application with PM2” everything stopped working. Basically my web app works when I run “node index.js” (index.js being where my express app starts) but when I try “pm2 start index.js” it says it’s started but I can’t reach it from my browser. It says it’s online http://i.imgur.com/U6lgxk0.png but it’s not. Help please.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I compiled my app.js using npm build then pm2 start public/app.js worked for me
There some issue with digital ocean server. I can start server with pm2 start app.js mony_rest_parameters" [PM2] Applying action restartProcessId on app [app](ids: 0) [PM2] app ✓ [PM2] Process successfully started ┌──────────┬────┬─────────┬──────┬───────┬────────┬─────────┬────────┬─────┬──────────┬───────────┬──────────┐ │ App name │ id │ version │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ user │ watching │ ├──────────┼────┼─────────┼──────┼───────┼────────┼─────────┼────────┼─────┼──────────┼───────────┼──────────┤ │ app │ 0 │ 0.0.0 │ fork │ 23428 │ online │ 5 │ 0s │ 0% │ 4.7 MB │ dev2rt987 │ disabled │ └──────────┴────┴─────────┴──────┴───────┴────────┴─────────┴────────┴─────┴──────────┴───────────┴──────────┘
0|app | server is listening on port 4000
but when I open server from browser. Request dont come to the server. I checked 4000 port its open and listening on the server.
instead of the command: pm2 start app.js try this command: pm2 start ./bin/www
you should use the same line after the pm2 start as you have in the start script of your package.json file in the express app root folder
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.