web-dev-qa-db-fra.com

Le redémarrage d'Apache2 a échoué dans Ubuntu 16.04

J'essaie d'utiliser domain pour mon localhost au lieu de localhost ou 127.0.0.1

J'ai ajouté un fichier de configuration myconfig.conf à sites-availbale. Je l'ai également activé à l'aide de Sudo a2ensite myconfig.conf

Lorsque je redémarre le serveur Apache2 en utilisant Sudo sudo systemctl restart Apache2, le message d'erreur suivant s'affiche:

Job for Apache2.service failed because the control process exited with error code. See "systemctl status Apache2.service" and "journalctl -xe" for details.

J'ai réinstallé Apache2 en le désinstallant, mais le message d'erreur suivant s'affiche:

Job for Apache2.service failed because the control process exited with error code. See "systemctl status Apache2.service" and "journalctl -xe" for details.
invoke-rc.d: initscript Apache2, action "start" failed.

sortie de Sudo journalctl -xe

May 26 12:42:51 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:52 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:53 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:54 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:55 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:56 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:57 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:58 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:42:59 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:00 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:01 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:02 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:03 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:04 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:05 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:06 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:07 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:08 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:09 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:10 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:11 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:12 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:13 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:14 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:15 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:16 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:17 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:18 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:19 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:20 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:21 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:22 vostro-tbe gnome-session[2123]: GET /chrome HTTP/1.1
May 26 12:43:22 vostro-tbe Sudo[16839]:     anuj : TTY=pts/1 ; PWD=/etc/Apache2/sites-available ; USER=root ; COMMAND=/bin/journalctl -xe
May 26 12:43:22 vostro-tbe Sudo[16839]: pam_unix(Sudo:session): session opened for user root by anuj(uid=0)

Sortie de systemctl status Apache2.service

● Apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/Apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/Apache2.service.d
           └─Apache2-systemd.conf
   Active: failed (Result: exit-code) since Thu 2016-05-26 12:42:43 IST; 53s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 16781 ExecStart=/etc/init.d/Apache2 start (code=exited, status=1/FAILURE)

May 26 12:42:43 vostro-tbe Apache2[16781]:  *
May 26 12:42:43 vostro-tbe Apache2[16781]:  * The Apache2 configtest failed.
May 26 12:42:43 vostro-tbe Apache2[16781]: Output of config test was:
May 26 12:42:43 vostro-tbe Apache2[16781]: Apache2: Syntax error on line 140 of /etc/Apache2/Apache2.conf: Syntax error on line 2 of /etc/Apache2/mods-enabled/php7.0.load: Cannot load /usr/lib/Apache2/modules/libphp7.0.so
May 26 12:42:43 vostro-tbe Apache2[16781]: Action 'configtest' failed.
May 26 12:42:43 vostro-tbe Apache2[16781]: The Apache error log may have more information.
May 26 12:42:43 vostro-tbe systemd[1]: Apache2.service: Control process exited, code=exited status=1
May 26 12:42:43 vostro-tbe systemd[1]: Failed to start LSB: Apache2 web server.
May 26 12:42:43 vostro-tbe systemd[1]: Apache2.service: Unit entered failed state.
May 26 12:42:43 vostro-tbe systemd[1]: Apache2.service: Failed with result 'exit-code'.

Sortie de Sudo Apache2ctl configtest

Apache2: Syntax error on line 140 of /etc/Apache2/Apache2.conf: Syntax error on line 2 of /etc/Apache2/mods-enabled/php7.0.load: Cannot load /usr/lib/Apache2/modules/libphp7.0.so into server: /usr/lib/Apache2/modules/libphp7.0.so: cannot open shared object file: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.

contenu de myconfig.conf

<VirtualHost *:80>
    ServerAdmin [email protected]
    ServerName website.com
    ServerAlias www.website.com
    DocumentRoot /var/www/html/website
    ErrorLog ${Apache_LOG_DIR}/error.log
    CustomLog ${Apache_LOG_DIR}/access.log combined
</VirtualHost>
7
Anuj TBE

Installez le paquet libapache2-mod-php7.0 ou désactivez le module PHP7 en lançant

Sudo a2dismod php7.0
15
Florian Diesch

Votre problème est avec vos 2 lignes dans votre fichier de configuration. Les 2 chemins de log provoquent une erreur avec Apache.

J'ai eu le même problème et lorsque j'ai supprimé les deux lignes de fichier journal exactement comme vous les aviez, j'ai pu redémarrer Apache.

1
Mike Mazur

Si vous utilisez php7, assurez-vous de désactiver le module php5:

Sudo a2dismod php5

cela a fonctionné pour moi

1
Claudio Zilio