Nginx ne redémarre pas automatiquement (resolu)

Bonjour

J’ai Erreur Token is invalid pour peertube et 401Le jeton d’accès n’est pas valide pour Mastodon.
J’ai vu sur le forum qu’il fallait redémarrer nginx avec

sudo service nginx restart

Mais a chaque fois que je me reconnecter sur mon compte Peertube ou Mastodon je suis obligé de retaper la commande.
Je voudrais savoir comment réglé çà.

Merci :wink:

Hmmm ben c’est bizarre … si nginx n’est pas lancé alors c’est potentiellement qu’il y a eu un probleme et que le processus a été tué j’imagine ? Du coup plutot que de chercher redémarrer la service automagiquement, il faudrait surtout chercher à comprendre pourquoi il n’est plus actif … Ce qui implique de fouiller un peu les logs.

Genre si tu re-rencontres le probleme, peux-tu donner la sortie de :

systemctl status nginx | cat

et/ou

journalctl -u nginx

Donc pour

systemctl status nginx | cat

j’ai

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2018-10-05 14:52:28 CEST; 2h 17min ago
     Docs: man:nginx(8)
  Process: 16068 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
 Main PID: 12838 (nginx)
    Tasks: 4 (limit: 4915)
   Memory: 56.6M
      CPU: 7.742s
   CGroup: /system.slice/nginx.service
           ├─12838 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─12839 nginx: worker process is shutting down
           ├─16074 nginx: worker process
           └─16075 nginx: worker process

pour

sudo journalctl -u nginx
    -- Logs begin at Thu 2018-10-04 19:29:45 CEST, end at Fri 2018-10-05 17:08:11 CE
    oct. 05 07:27:37 mondomainemastodon.tld systemd[1]: Stopping A high performance web
    oct. 05 07:27:42 mondomainemastodon.tld systemd[1]: nginx.service: Stopping timed o
    oct. 05 07:27:42 mondomainemastodon.tld systemd[1]: Stopped A high performance web 
    oct. 05 07:27:42 mondomainemastodon.tld systemd[1]: nginx.service: Unit entered fai
    oct. 05 07:27:42 mondomainemastodon.tld systemd[1]: nginx.service: Failed with resu
    oct. 05 07:29:04 mondomainemastodon.tld systemd[1]: Starting A high performance web
    oct. 05 07:29:05 mondomainemastodon.tld systemd[1]: Started A high performance web 
    oct. 05 07:34:05 mondomainemastodon.tld systemd[1]: Stopping A high performance web
    oct. 05 07:34:10 mondomainemastodon.tld systemd[1]: Stopped A high performance web 
    oct. 05 07:34:10 mondomainemastodon.tld systemd[1]: Starting A high performance web
    oct. 05 07:34:11 mondomainemastodon.tld systemd[1]: Started A high performance web 
    oct. 05 07:50:31 mondomainemastodon.tld systemd[1]: Stopping A high performance web
    oct. 05 07:50:36 mondomainemastodon.tld systemd[1]: Stopped A high performance web 
    oct. 05 07:52:18 mondomainemastodon.tld systemd[1]: Starting A high performance web
    oct. 05 07:52:18 mondomainemastodon.tld systemd[1]: Started A high performance web 
    oct. 05 13:42:28 mondomainemastodon.tld systemd[1]: Stopping A high performance web
    oct. 05 13:42:28 mondomainemastodon.tld systemd[1]: Stopped A high performance web 
    oct. 05 13:42:28 mondomainemastodon.tld systemd[1]: Starting A high performance web
    oct. 05 13:42:28 mondomainemastodon.tld systemd[1]: Started A high performance web 
    oct. 05 13:57:44 mondomainemastodon.tld systemd[1]: Stopping A high performance web
    oct. 05 13:57:49 mondomainemastodon.tld systemd[1]: Stopped A high performance web 
    oct. 05 13:57:49 mondomainemastodon.tld systemd[1]: Starting A high performance web

Peux-tu faire un :

tail -n 20 /var/log/nginx/tondomainemastodon.tld-error.log
tail -n 20 /var/log/nginx/tondomainemastodon.tld-access.log

?

Rend ton log anonyme si tu le colles ici.

tail -n 20 /var/log/nginx/tondomainemastodon.tld-error.log
2018/10/07 06:28:34 [error] 3313#3313: *15168 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 06:34:19 [error] 3313#3313: *15273 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 06:40:03 [error] 3313#3313: *15358 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 06:46:18 [error] 3313#3313: *15472 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 06:52:06 [error] 3313#3313: *15561 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 06:59:47 [error] 3312#3312: *15935 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:05:48 [error] 3312#3312: *16140 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:11:46 [error] 3312#3312: *16296 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:17:34 [error] 3312#3312: *16450 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:23:46 [error] 3313#3313: *16666 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:31:15 [error] 3312#3312: *16936 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:37:13 [error] 3313#3313: *17137 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
2018/10/07 07:42:58 [error] 29858#29858: *54 "/usr/share/nginx/html/yunohost/sso/index.html" is not found (2: No such file or directory), client: 192.0.101.226, server: mondomainemastodon.tld, request: "HEAD /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL2Jsb2c= HTTP/1.1", host: "mondomainemastodon.tld"
tail -n 20 /var/log/nginx/tondomainemastodon.tld-access.log
monIp - - [07/Oct/2018:07:47:32 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:32 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:34 +0200] "POST /ampache/server/ajax.server.php?page=index&action=reloadnp HTTP/1.1" 200 39422 "https://mondomainemastodon.tld/ampache/index.php" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:37 +0200] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:37 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:37 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:42 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:42 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:47 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:47 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:50 +0200] "POST /ampache/server/ajax.server.php?page=index&action=reloadnp HTTP/1.1" 200 26082 "https://mondomainemastodon.tld/ampache/index.php" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:52 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:52 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:57 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:47:57 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:48:02 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:48:02 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:48:07 +0200] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 200 74 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:48:07 +0200] "POST /torrent/transmission/rpc HTTP/1.1" 302 224 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"
monIp - - [07/Oct/2018:07:48:07 +0200] "GET /yunohost/sso/?r=aHR0cHM6Ly9sYWdyb3R0ZWRlbG91cnMub3ZoL3RvcnJlbnQvdHJhbnNtaXNzaW9uL3JwYw== HTTP/1.1" 200 1043 "https://mondomainemastodon.tld/torrent/transmission/web/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0"

cool
J’ai résolu mon problème en installant nginx extra