우분투 16.04에서 Apache2 재시작 실패


6

내가 사용하려고 domain내를 위해 localhost대신 localhost또는127.0.0.1

구성 파일 myconfig.conf을 추가했으며 sites-availbale 다음을 사용하여 활성화했습니다.sudo a2ensite myconfig.conf

를 apache2사용하여 서버를 다시 시작 sudo sudo systemctl restart apache2하면 오류가 발생합니다.

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

apache2제거하여 다시 설치 했지만 다음과 같은 오류가 발생합니다.

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.

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)

출력 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'.

출력 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.

의 내용 myconfig.conf

<VirtualHost *:80>
    ServerAdmin admin@website.com
    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>

myconfig.conf에 문제가 있습니다.
— MKay

myconfig.conf
— Anuj TBE의

답변:


15

다음 libapache2-mod-php7.0을 실행하여 패키지 설치 또는 PHP7 모듈 비활성화

sudo a2dismod php7.0

1
에 설치 libapache2-mod-php7.0되었지만 여전히 동일한 오류sudo systemctl restart apache2
— Anuj TBE

1
php7하지만 여전히 같은 오류 해제와 시도
— 아누 즈 TBE를

해결되었습니다! 설치libapache2-mod-php7.0
— Anuj TBE

1
내 문제도 해결했다. Ubuntu / Kubuntu 16.04.2 LTS Xenial (이전 php5 설치). sudo apt-get install libapache2-mod-php7.0그런 다음 apache2ctl configtest(저널 -xe보다 낫습니다) 마지막으로sudo service apache2 start
— user23731

5

나도 같은 문제를 겪었고 그 원인은 다음과 같습니다.

에 가상 호스트 example.com.conf를 etc/apache2/sites-available만들었으므로 etc/apache2/sites-enabled해당 특정 호스트에 가상 호스트를 활성화 할 때 링크가 만들어졌습니다 .

나중에 example.com.conf 파일을에서 삭제 etc/apache2/sites-available했지만 호스트의 링크를 계속 사용할 수 있도록 호스트를 비활성화하는 것을 잊어 버렸습니다 etc/apache2/sites-enabled. 그래서 내 경우 오류가 발생하여 링크 된 파일을 삭제하고 etc/apache2/sites-enabled아파치가 시작되었습니다. 일.


이것은 완벽하게 작동합니다
— Killer

이것은 conf 파일을 제거하고 다시 시작한 후에도 나를위한 해결책이었습니다.
— CSharpened


1

문제는 구성 파일의 두 줄에 있습니다. 2 개의 로그 경로는 Apache에서 오류를 발생시킵니다.

나는이 같은 문제가 있었고 두 로그 파일 줄을 제거했을 때 아파치를 다시 시작할 수있었습니다.


이것은 내 문제도 해결했습니다. 로그 파일 구성이 기존 위치가 아닌 것을 가리 켰습니다. 수행 한 후 해결mkdir -p /my/log/location/
— Renaat 드 Muynck
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.