Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

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!
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.
Accepted Answer
Hmmm all that sounds like it should work…
Just to be clear, this is what your nginx config should look like:
server {
listen 80;
server_name mydomain.com www.mydomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name mydomain.com www.mydomain.com;
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
location / {
proxy_pass http://localhost:3010;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
and make sure your server.js node app is running on port 3010.
i.e.: in express.js…
const express = require('express');
const app = express();
app.get('/', function (req, res) { res.send('Hello World!')});
app.listen(3010, function() { console.log('Example app listening on port 3010!'); });
Then confirm nginx is running with sudo service nginx status and confirm your node app is running with forever list or check the forever logs with forever logs server.js
More reference on running node.js in reverse proxy with nginx here: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04
Hello,
In addition to what has already been mentioned, I could also suggest taking a look at this quick video tutorial on how to deploy a Node.js App on Ubuntu with PM2, NGINX and Cloudflare:
Hope that this helps. Best, Bobby