I want to deploy my app on Ubuntu 20 and then running forever on pm2
But first how do i make the app running ?
MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://localhost:3000 node main.js
I tried the above script and the server (backend) is running ok. However, i don’t see the frontend thing .
I failed to curl http://localhost:3000  .
If i try this script MONGO_URL=mongodb://localhost:27017/myapp ROOT_URL=http://my-app.com node main.js
I could acess the app through http://my-app.com, But i don’t know how to apply the nginx setting.
How to deploy the meteor plain node app
And modify the basic nginx config to increase the worker_connection for multi-core CPU.
I don’t know how to config the nginx and i tried something like below
`
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 10240;
multi_accept on;
}
http {
# websockets upgrade mapping
map $http_upgrade $connection_upgrade {
default upgrade;
‘’ close;
}
# load balance 4 instances of a node process
upstream my-app.com {
    server 127.0.0.1:3000;
    server 127.0.0.1:3001;
    server 127.0.0.1:3002;
    server 127.0.0.1:3003;
}
# server endpoint configuration
server {
    listen                  80;
    server_name             my-app.com;
}
server {
    listen                  443 ssl;
    keepalive_timeout       5m;
    # SSL configuration
    server_name             my-app.com;
    location / {
        # websockets configuration, using our mapping
        proxy_pass          http://my-app.com;
        proxy_http_version  1.1;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    Connection $connection_upgrade;
    }
}
}`
