Nginx won't start after I changed domain name

Bonjour, (if you prefer english, just ask :slight_smile: )

Sur mon install récente de Yunohost, j’ai changé le nom de domaine vers un sous-domaine de celui que j’avais rentré au préalable (yunohost.mon_nom_de_domaine.fr à la place de mon_nom_de_domaine.fr)
suite à un redémarrage de la machine, nginx ne démarre plus :

root@yunohost:/etc/yunohost/certs# cat /var/log/nginx/error.log
2017/01/03 15:54:31 [emerg] 458#0: BIO_new_file("/etc/yunohost/certs/mon_nom_de_domaine.fr/crt.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(’/etc/yunohost/certs/mon_nom_de_domaine.fr/crt.pem’,‘r’) error:2006D080:BIO routines:BIO_new_file:no such file)

Comment pourrais-je dépanner ça ? (je suis un noob du Nginx…)

Merci d’avance !

Ca semble venir de ton certificat situé ici /etc/yunohost/certs/mon_nom_de_domaine.fr/crt.pem
As tu vérifié s’il est la ? nginx, son groupe, ou tous les autres a t-il les droits en lecture au minimum
Voici mes log sur mon instance de yunohost

root@totofr:/etc/yunohost# ls
apps	      firewall.yml	hooks.d    services.yml
certs	      firewall.yml.old	installed  services.yml-old
current_host  from_script	mysql
root@totofr:/etc/yunohost# cd certs/
root@totofr:/etc/yunohost/certs# ls
blog.toto.fr	toto.fr		     shop.toto.fr
cops.toto.fr	toto.fr.beforeLetsEncrypt  yunohost.org
root@totofr:/etc/yunohost/certs# cd toto.fr
root@totofr:/etc/yunohost/certs/toto.fr# ls -la
total 8
drwxr-xr-x 2 root root 4096 oct.   6 23:07 .
drwxr-xr-x 8 root root 4096 janv.  3 21:51 ..
lrwxrwxrwx 1 root root   45 oct.   6 23:07 crt.pem -> /etc/letsencrypt/live/toto.fr/fullchain.pem
lrwxrwxrwx 1 root root   43 oct.   6 23:07 key.pem -> /etc/letsencrypt/live/toto.fr/privkey.pem
root@totofr:/etc/yunohost/certs/toto.fr# cd ..
root@totofr:/etc/yunohost/certs# ls -la
total 32
drwxr-xr-x 8 root root 4096 janv.  3 21:51 .
drwxr-xr-x 5 root root 4096 oct.   6 23:35 ..
drwxr-xr-x 2 root root 4096 oct.   6 23:46 blog.toto.fr
drwxr-xr-x 2 root root 4096 janv.  3 21:51 cops.toto.fr
drwxr-xr-x 2 root root 4096 oct.   6 23:07 toto.fr
drwxr-xr-x 2 root root 4096 oct.   6 22:21 toto.fr.beforeLetsEncrypt
drwxr-xr-x 2 root root 4096 oct.  26 22:31 shop.toto.fr
drwxr-xr-x 2 root root 4096 oct.   6 21:55 yunohost.org
root@totofr:/etc/yunohost/certs# ls -la toto.fr
total 8
drwxr-xr-x 2 root root 4096 oct.   6 23:07 .
drwxr-xr-x 8 root root 4096 janv.  3 21:51 ..
lrwxrwxrwx 1 root root   45 oct.   6 23:07 crt.pem -> /etc/letsencrypt/live/toto.fr/fullchain.pem
lrwxrwxrwx 1 root root   43 oct.   6 23:07 key.pem -> /etc/letsencrypt/live/toto.fr/privkey.pem
root@totofr:/etc/yunohost/certs# ls -la toto.fr.beforeLetsEncrypt/
total 32
drwxr-xr-x 2 root root      4096 oct.   6 22:21 .
drwxr-xr-x 8 root root      4096 janv.  3 21:51 ..
lrwxrwxrwx 1 root root        34 oct.   6 22:21 ca.pem -> /etc/ssl/certs/ca-yunohost_crt.pem
-rw-r----- 1 root metronome 5609 oct.   6 22:21 crt.pem
-rw-r----- 1 root metronome 1704 oct.   6 22:21 key.pem
-rw------- 1 root root      8866 oct.   6 22:21 openssl.cnf
root@totofr:/etc/yunohost/certs# ls -la /etc/letsencrypt/live/toto.fr/
total 8
drwxr-xr-x 2 root root      4096 déc.  11 01:39 .
drwxr-x--- 3 root metronome 4096 oct.   6 23:07 ..
lrwxrwxrwx 1 root root        33 déc.  11 01:39 cert.pem -> ../../archive/toto.fr/cert2.pem
lrwxrwxrwx 1 root root        34 déc.  11 01:39 chain.pem -> ../../archive/toto.fr/chain2.pem
lrwxrwxrwx 1 root root        38 déc.  11 01:39 fullchain.pem -> ../../archive/toto.fr/fullchain2.pem
lrwxrwxrwx 1 root root        36 déc.  11 01:39 privkey.pem -> ../../archive/toto.fr/privkey2.pem
root@totofr:/etc/yunohost/certs# ls -la /etc/letsencrypt/archive/toto.fr/
total 40
drwxr-xr-x 2 root root      4096 déc.  11 01:39 .
drwxr-x--- 3 root metronome 4096 oct.   6 23:07 ..
-rw-r--r-- 1 root root      2126 oct.   6 23:07 cert1.pem
-rw-r--r-- 1 root root      2126 déc.  11 01:39 cert2.pem
-rw-r--r-- 1 root root      1647 oct.   6 23:07 chain1.pem
-rw-r--r-- 1 root root      1647 déc.  11 01:39 chain2.pem
-rw-r--r-- 1 root root      3773 oct.   6 23:07 fullchain1.pem
-rw-r--r-- 1 root root      3773 déc.  11 01:39 fullchain2.pem
-rw-r--r-- 1 root root      3272 oct.   6 23:07 privkey1.pem
-rw-r--r-- 1 root root      3268 déc.  11 01:39 privkey2.pem

Salut @madmaxlamenace , merci de tenter de m’aider :slight_smile:

En fait, ce certificat n’a plus lieu d’être puisque j’ai changé le nom de domaine mon_nom_de_domaine.fr vers yunohost.mon_nom_de_domaine.fr.
le fichier /etc/yunohost/certs/yunohost.mon_nom_de_domaine.fr/crt.pem est bien présent lui, et pour moi le système ne devrait pas avoir besoin de l’ancien…

Apparemment le domaine n’a pas été supprimé dans nginx. et la conf du domaine par la même occasion.
Regardes les repertoires dans /etc/nginx/conf.d

Ok c’est bien ça, j’ai supprimé les 2 fichiers mon_nom_de_domaine.fr.conf et mon_nom_de_domaine.fr.d, puis rebooté et nginx est correctement démarré :slight_smile:
Merci pour ton aide @madmaxlamenace !

De rien
Par contre y a peut être d’autres choses qui traîne…
En effet tes infos de domaine ont mal été supprimées, je ne sais pas à quel point. Ça pourrait te poser des problème plus tard si tu ajoutes ce domaine par exemple.

@vivien Pour supprimer le domaine précédent tu as bien utilisé l’interface administrateur ou la cli yunohost ?

@ljf j’ai tout fait (création et suppression des noms de domaine) via l’interface administrateur