If you nerer installed it previously, you can check classic tutorials for Debian - https://www.google.com/search?q=nodejs+ ... +debian+10
Only important things is that you should just skip nginx configuring, since we will do that via the following templates.
Once you run simple nodejs app on port 3000, you can find nodejs nginx templates here https://github.com/myvesta/vesta/tree/m ... -templates - simply download these files to /usr/local/vesta/data/templates/web/nginx/ folder.
Alternatively you can use this command to download all nodejs-nginx-templates to your /usr/local/vesta/data/templates/web/nginx/ folder:
There you have few different templates:
Code: Select all
cd /usr/local/vesta/data/templates/web/nginx/ svn checkout --depth=empty https://github.com/myvesta/vesta/trunk/src/deb/for-download/tools/nodejs-nginx-templates . svn update --set-depth=infinity --force
- node-app-3000 = probably most universal template for nodejs apps, will always redirect visitors to https
- node-app-3000-no-https-force = the same as previous but without redirecting visitors to https
- node-app-3000-pass-to-https = will communicate with nodejs app via https connection (if you want SSL encrypted connection between nginx and your nodejs app)
- node-app-also-handle-static-files-3000 = nginx will not serve static files with this template, requests for static files will be forwarded to nodejs app (for all nodejs apps that needs its own serving of static files, useful for NextJS apps for example)
- node-app-4000-and-websocket-6001 = the same as first template, but all requests to /app/ folder will be proxied to websocket on port 6001
If you have another apps on different ports, simply make new template (using one of these templates) and just (by editing your new template) change '3000' to some new port, for example '3001'. Here you can see how to achieve that: viewtopic.php?f=20&t=628
P.S. If you want to use these templates in apache-less myVesta installations (installed myVesta without Apache, just nginx installed), then replace ports in template:
Code: Select all
sed -i "s#%proxy_port%#%web_port%#g" /usr/local/vesta/data/templates/web/nginx/node-app-3000.tpl sed -i "s#%proxy_ssl_port%#%web_ssl_port%#g" /usr/local/vesta/data/templates/web/nginx/node-app-3000.stpl