Bonsoir , aprés avoir installer nginx et lorsque j'aimerai le démarrer avec la commande :
sudo service nginx start


j'ai le message d'erreur suivant :
ahmadou@ahmadou-GF63-Thin-9RCX:~$ sudo service nginx start
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
ahmadou@ahmadou-GF63-Thin-9RCX:~$
j'ai essayé les commandes :
sudo fuser -k 80/tcp
sudo fuser -k 443/tcp
ça n'a toujours pas marché , parce que si je fais
sudo service nginx start

j'ai toujours le meme message d'erreur, Merci de votre aide.
See "systemctl status nginx.service" and "journalctl -xe" for details.
Il faut que tu partages l'erreur loggée !!!

Et puis les trucs "fuser" je vois pas bien ce que ça vient faire là. Pour moi fuser n'a rien à voir avec le firewall !

Et utilise "sudo systemctl start nginx" parce que "service" c'est l'ancienne façon de faire (ça change pas grand chose mais bon autant utiliser les bonnes commandes).
Modération : déplacé dans la section idoine.

--
Les logs. Que disent les logs ? /var/log/nginx/error.log
Vobul a écrit
See "systemctl status nginx.service" and "journalctl -xe" for details.
Il faut que tu partages l'erreur loggée !!!

Et puis les trucs "fuser" je vois pas bien ce que ça vient faire là. Pour moi fuser n'a rien à voir avec le firewall !

Et utilise "sudo systemctl start nginx" parce que "service" c'est l'ancienne façon de faire (ça change pas grand chose mais bon autant utiliser les bonnes commandes).
voilà ce que ça donne :
ahmadou@ahmadou-GF63-Thin-9RCX:~$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset:>
     Active: failed (Result: exit-code) since Fri 2020-10-16 14:27:39 CET; 54mi>
       Docs: man:nginx(8)

oct. 16 14:27:38 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] bind() to >
oct. 16 14:27:38 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] bind() to >
oct. 16 14:27:38 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] bind() to >
oct. 16 14:27:38 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] bind() to >
oct. 16 14:27:39 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] bind() to >
oct. 16 14:27:39 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] bind() to >
oct. 16 14:27:39 ahmadou-GF63-Thin-9RCX nginx[16701]: nginx: [emerg] still coul>
oct. 16 14:27:39 ahmadou-GF63-Thin-9RCX systemd[1]: nginx.service: Control proc>
oct. 16 14:27:39 ahmadou-GF63-Thin-9RCX systemd[1]: nginx.service: Failed with >
oct. 16 14:27:39 ahmadou-GF63-Thin-9RCX systemd[1]: Failed to start A high perf>
lines 1-15/15 (END)...skipping...

ahmadou@ahmadou-GF63-Thin-9RCX:~$ journalctl -xe
oct. 16 15:19:38 ahmadou-GF63-Thin-9RCX dbus-daemon[794]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1>
oct. 16 15:19:38 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:38] Cannot reach: https://daisy.ubuntu.com
oct. 16 15:19:38 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:38] offline
oct. 16 15:19:38 ahmadou-GF63-Thin-9RCX systemd[1]: Starting Network Manager Script Dispatcher Service...
-- Subject: L'unité (unit) NetworkManager-dispatcher.service a commencé à démarrer
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- L'unité (unit) NetworkManager-dispatcher.service a commencé à démarrer.
oct. 16 15:19:38 ahmadou-GF63-Thin-9RCX dbus-daemon[794]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
oct. 16 15:19:38 ahmadou-GF63-Thin-9RCX systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: L'unité (unit) NetworkManager-dispatcher.service a terminé son démarrage
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- L'unité (unit) NetworkManager-dispatcher.service a terminé son démarrage, avec le résultat done.
oct. 16 15:19:41 ahmadou-GF63-Thin-9RCX NetworkManager[795]: <info>  [1602857981.0178] manager: NetworkManager state is now CONNECTED_GLOBAL
oct. 16 15:19:41 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:41] Cannot reach: https://daisy.ubuntu.com
oct. 16 15:19:41 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:41] The default IPv4 route is: /org/freedesktop/NetworkManager/ActiveConnection/1
oct. 16 15:19:41 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:41] Not a paid data plan: /org/freedesktop/NetworkManager/ActiveConnection/1
oct. 16 15:19:41 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:41] Found usable connection: /org/freedesktop/NetworkManager/ActiveConnection/1
oct. 16 15:19:42 ahmadou-GF63-Thin-9RCX whoopsie[1178]: [15:19:42] online
oct. 16 15:19:51 ahmadou-GF63-Thin-9RCX systemd[1]: NetworkManager-dispatcher.service: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- The unit NetworkManager-dispatcher.service has successfully entered the 'dead' state.
oct. 16 15:20:21 ahmadou-GF63-Thin-9RCX sudo[22240]:  ahmadou : TTY=pts/1 ; PWD=/home/ahmadou ; USER=root ; COMMAND=/usr/bin/apt install nginx
oct. 16 15:20:21 ahmadou-GF63-Thin-9RCX sudo[22240]: pam_unix(sudo:session): session opened for user root by (uid=0)
oct. 16 15:20:37 ahmadou-GF63-Thin-9RCX systemd[1]: Reloading.
oct. 16 15:20:37 ahmadou-GF63-Thin-9RCX systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/d>
oct. 16 15:20:37 ahmadou-GF63-Thin-9RCX systemd[1]: Configuration file /lib/systemd/system/mssql-server.service is marked executable. Please remove executable permission bits. Proceeding anyway.
oct. 16 15:20:37 ahmadou-GF63-Thin-9RCX systemd[1]: Reloading.
oct. 16 15:20:37 ahmadou-GF63-Thin-9RCX systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/d>
oct. 16 15:20:37 ahmadou-GF63-Thin-9RCX systemd[1]: Configuration file /lib/systemd/system/mssql-server.service is marked executable. Please remove executable permission bits. Proceeding anyway.
oct. 16 15:20:43 ahmadou-GF63-Thin-9RCX systemd[1]: Reloading.
oct. 16 15:20:43 ahmadou-GF63-Thin-9RCX systemd[1]: /lib/systemd/system/dbus.socket:5: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/d>
oct. 16 15:20:43 ahmadou-GF63-Thin-9RCX systemd[1]: Configuration file /lib/systemd/system/mssql-server.service is marked executable. Please remove executable permission bits. Proceeding anyway.
oct. 16 15:20:47 ahmadou-GF63-Thin-9RCX dbus-daemon[794]: [system] Activating via systemd: service name='org.freedesktop.PackageKit' unit='packagekit.service' requested by ':1.161' (uid=0 pid=22880 comm>
oct. 16 15:20:47 ahmadou-GF63-Thin-9RCX systemd[1]: Starting PackageKit Daemon...
-- Subject: L'unité (unit) packagekit.service a commencé à démarrer
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- L'unité (unit) packagekit.service a commencé à démarrer.
oct. 16 15:20:47 ahmadou-GF63-Thin-9RCX PackageKit[22883]: daemon start
oct. 16 15:20:47 ahmadou-GF63-Thin-9RCX dbus-daemon[794]: [system] Successfully activated service 'org.freedesktop.PackageKit'
oct. 16 15:20:47 ahmadou-GF63-Thin-9RCX systemd[1]: Started PackageKit Daemon.
-- Subject: L'unité (unit) packagekit.service a terminé son démarrage
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- L'unité (unit) packagekit.service a terminé son démarrage, avec le résultat done.
oct. 16 15:20:47 ahmadou-GF63-Thin-9RCX sudo[22240]: pam_unix(sudo:session): session closed for user root

ahmadou@ahmadou-GF63-Thin-9RCX:~$ 

La commande :
journalctl -xe
n'est utile que si elle lancée immédiatement après l'échec du démarrage d'un service.

Donne-nous le contenu des logs (/var/log/nginx/error.log) ou le retour de :
journalctl -l --no-pager -u nginx
--
[HS]
systemd est vraiment très efficace pour tout un tas de choses. Par contre les retours de systemctl, jouynalctl, etc. s'affichent dans un pager qui par défaut ne s’adapte pas à la largeur du terminal et donc tronque les lignes c'est particulièrement pénible pour les utilisateurs novices. Et l'indication systématique d'avoir recours à journalctl -xe est tout aussi pénible car les utilisateurs ne comprennent pas cette commande et la lancent 3 jours après l'échec du service concerné. :/
[/HS]
@bruno +1

Sinon même si on voit pas l'erreur, je parie que c'est qu'il ne peut pas bind sur un port car il est déjà occupé. Donc il faut s'assurer qu'il n'y a rien d'autre qui écoute sur ces ports (Apache peut-être ?). Maintenant je comprends mieux l'utilisation de "fuser", c'était pour kill ce qui écoute sur ces ports. L'utilisation de netstat semble indiquée :
netstat -tulpn | grep :80
netstat -tulpn | grep :443
hop, trois remarques :
- netstat risque de disparaître à terme, on lui préférera ss
- nul besoin de voir les connexions udp (-u)
- lancé en root on peut voir le nom des processus, sinon -p est quasiment inutile
Donc :
sudo netstat -tlnp
ou au choix :
sudo ss -tlnp
ok merci bruno je ne connaissais pas ss !