Maintien en ligne d'une application node.js (VPS Ubuntu 18)
BMPCreated with Sketch.BMPZIPCreated with Sketch.ZIPXLSCreated with Sketch.XLSTXTCreated with Sketch.TXTPPTCreated with Sketch.PPTPNGCreated with Sketch.PNGPDFCreated with Sketch.PDFJPGCreated with Sketch.JPGGIFCreated with Sketch.GIFDOCCreated with Sketch.DOC Error Created with Sketch.
Question

Maintien en ligne d'une application node.js (VPS Ubuntu 18)

by
LucienM
Created on 2019-06-24 11:56:20 (edited on 2024-09-04 11:57:17) in Serveurs Privés Virtuels (VPS)

Bonjour,

j'ai déployé une application node.js sur un VPS sous Ubuntu 18, qui tourne très bien. Néanmoins, l'application s'éteint automatiquement après un certain temps en ligne (ma connexion en SSH s'arrête avec le code 22 - connection reset by peer). Comment empêcher cela ?

Merci d'avance!


2 Replies ( Latest reply on 2019-06-24 13:36:51 by
LucienM
)

c'est ta connexion SSH qui maintient ton appli?
ce n'est pas la bonne méthode

pour le SSH, pour le serveur:
`/etc/ssh/sshd_config` :

```text
ClientAliveInterval 300
ClientAliveCountMax 2
```
tu peux aussi côté client :
```text
Host *
ServerAliveInterval 60
ServerAliveCountMax 2
```
dans un fichier `~/.ssh/config` ou `/etc/ssh/ssh_config`:

Oui, c'est la connexion SSH qui maintient l'appli. Maintenant que tu le dis c'est vrai que je devrais faire autrement !

Merci !

oui, ou tu peux essayer avec screen https://wiki.debian.org/fr/Screen
mais pour node.js, il y a mieux (je ne connais pas)

Nickel, je vais me renseigner, je marque comme résolu et je vais faire mes recherches de mon côté ! Bonne journée !

Edit si d'autres ont mon problème, https://stackoverflow.com/questions/12701259/how-to-make-a-node-js-application-run-permanently/40254977 ce thread en parle également.