Apache, 문제 LSB 시작 실패: Apache2 웹 서버

Apache, 문제 LSB 시작 실패: Apache2 웹 서버

우분투 16.02를 사용합니다. 시도하면 다음과 sudo service apache2 restart같이 표시됩니다.

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

그런 다음 다음을 입력 journalctl -xe하고 다음을 요청합니다.

--
-- 유닛 apache2.service가 시작되기 시작했습니다.
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 1: /etc/apache2/envvars: envvars: 찾을 수 없음
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 49: /etc/apache2/envvars: envvars: 찾을 수 없음
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 1: /etc/apache2/envvars: envvars: 찾을 수 없음
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 49: /etc/apache2/envvars: envvars: 찾을 수 없음
Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: * Apache httpd 웹 서버 apache2 시작
1월 11일 02:30:46 알렉산드르-VirtualBox apache2[8177]: *
Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: * apache2 구성 테스트가 실패했습니다.
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: 구성 테스트의 출력은 다음과 같습니다.
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 1: /etc/apache2/envvars: envvars: 찾을 수 없음
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 49: /etc/apache2/envvars: envvars: 찾을 수 없음
Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: (2) 해당 파일 또는 디렉터리가 없습니다: AH02291: 기본 오류 로그에 대해 '/etc/apache2/logs/' 디렉터리에 액세스할 수 없습니다.
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: AH00014: 구성 확인 실패
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: 'configtest' 작업이 실패했습니다.
Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: Apache 오류 로그에 추가 정보가 있을 수 있습니다.
1월 11일 02:30:46 aleksandr-VirtualBox systemd[1]: apache2.service: 제어 프로세스가 종료됨, 코드=종료 상태=1
1월 11일 02:30:46 aleksandr-VirtualBox sudo[8171]: pam_unix(sudo:session): 사용자 루트에 대한 세션이 닫혔습니다.
Jan 11 02:30:46 aleksandr-VirtualBox systemd[1]: LSB를 시작하지 못했습니다: Apache2 웹 서버.
-- 제목: apache2.service 장치가 실패했습니다.
-- 정의자: systemd
-- 지원: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- apache2.service 유닛이 실패했습니다.
--
-- 결과는 실패했습니다.
1월 11일 02:30:46 aleksandr-VirtualBox systemd[1]: apache2.service: 장치가 실패 상태로 전환되었습니다.
1월 11일 02:30:46 aleksandr-VirtualBox systemd[1]: apache2.service: 'exit-code' 결과로 실패했습니다.
1월 11일 02:33:09 aleksandr-VirtualBox dhclient[792]: enp0s8에서 192.168.56.101의 DHCPREQUEST - 192.168.56.100 포트 67(xid=0x204f076f)
1월 11일 02:33:09 aleksandr-VirtualBox dhclient[792]: 192.168.56.100에서 192.168.56.101의 DHCPACK
1월 11일 02:33:09 aleksandr-VirtualBox NetworkManager[619]: [1484073189.4253] 주소 192.168.56.101
1월 11일 02:33:09 aleksandr-VirtualBox NetworkManager[619]: [1484073189.4260] plen 24 (255.255.255.0)
1월 11일 02:33:09 aleksandr-VirtualBox NetworkManager[619]: [1484073189.4266] 서버 식별자 192.168.56.100
1월 11일 02:33:09 aleksandr-VirtualBox NetworkManager[619]: [1484073189.4273] 임대 시간 1200
1월 11일 02:33:09 aleksandr-VirtualBox NetworkManager[619]: [1484073189.4279] dhcp4 (enp0s8): 상태 변경 바운드 -> 바운드
Jan 11 02:33:09 aleksandr-VirtualBox dbus[590]: [system] systemd를 통해 활성화: 서비스 이름='org.freedesktop.nm_dispatcher' 단위='dbus-org.freedesktop.nm-dispatcher.service'
Jan 11 02:33:09 aleksandr-VirtualBox systemd[1]: Network Manager 스크립트 디스패처 서비스 시작 중...
-- 제목: Unit NetworkManager-dispatcher.service가 시작되었습니다.
-- 정의자: systemd
-- 지원하다:
--
-- 장치 NetworkManager-dispatcher.service가 시작되었습니다.
Jan 11 02:33:09 aleksandr-VirtualBox dhclient[792]: 192.168.56.101로 바인딩됨 -- 559초 만에 갱신.
Jan 11 02:33:09 aleksandr-VirtualBox dbus[590]: [system] 'org.freedesktop.nm_dispatcher' 서비스를 성공적으로 활성화했습니다.
Jan 11 02:33:09 aleksandr-VirtualBox systemd[1]: Network Manager 스크립트 디스패처 서비스를 시작했습니다.
-- 제목: 장치 NetworkManager-dispatcher.service가 시작을 완료했습니다.
-- 정의자: systemd
-- 지원하다:
--
-- 장치 NetworkManager-dispatcher.service 시작이 완료되었습니다.
--
-- 시작 결과가 완료되었습니다.
1월 11일 02:33:09 aleksandr-VirtualBox nm-dispatcher[8205]: req:1 'dhcp4-change' [enp0s8]: 새 요청(1 스크립트)
1월 11일 02:33:09 aleksandr-VirtualBox nm-dispatcher[8205]: req:1 'dhcp4-change' [enp0s8]: 순서가 지정된 스크립트 실행을 시작합니다...

그리고 systemctl status apache2.service가장 중요한 때는:

* apache2.service - LSB: Apache2 웹 서버
   로드됨: 로드됨(/etc/init.d/apache2; 불량; 공급업체 사전 설정: 활성화됨)
  드롭인: /lib/systemd/system/apache2.service.d
           `-apache2-systemd.conf
   활성: 2017년 1월 11일 수요일 02:30:46 +08 이후 실패했습니다(결과: 종료 코드). 33분 전
     문서: man:systemd-sysv-generator(8)
  프로세스: 8023 ExecStop=/etc/init.d/apache2 중지(코드=종료, 상태=0/SUCCESS)
  프로세스: 2236 ExecReload=/etc/init.d/apache2 reload(코드=종료, 상태=0/SUCCESS)
  프로세스: 8177 ExecStart=/etc/init.d/apache2 start(코드=종료, 상태=1/FAILURE)

1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 1: /etc/apache2/envvars: envvars: 찾을 수 없음
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 49: /etc/apache2/envvars: envvars: 찾을 수 없음
Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: (2) 해당 파일 또는 디렉터리가 없습니다: AH02291: 기본 오류 로그에 대해 '/etc/apache2/logs/' 디렉터리에 액세스할 수 없습니다.
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: AH00014: 구성 확인 실패
1월 11일 02:30:46 aleksandr-VirtualBox apache2[8177]: 'configtest' 작업이 실패했습니다.
Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: Apache 오류 로그에 추가 정보가 있을 수 있습니다.
1월 11일 02:30:46 aleksandr-VirtualBox systemd[1]: apache2.service: 제어 프로세스가 종료됨, 코드=종료 상태=1
Jan 11 02:30:46 aleksandr-VirtualBox systemd[1]: LSB를 시작하지 못했습니다: Apache2 웹 서버.
1월 11일 02:30:46 aleksandr-VirtualBox systemd[1]: apache2.service: 장치가 실패 상태로 전환되었습니다.
1월 11일 02:30:46 aleksandr-VirtualBox systemd[1]: apache2.service: 'exit-code' 결과로 실패했습니다.

뭐가 잘못 되었 니? 인터럽트는 어디에 있습니까? 도와주세요!

답변1

두 가지 오류가 있습니다:


1.어떤 이유로 귀하가 /etc/apache2/envvars누락되었습니다:

  • 에서 journalctl -xe:

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 49: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /etc/init.d/apache2: 49: /etc/apache2/envvars: envvars: not found
    ...        
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 49: /etc/apache2/envvars: envvars: not found
    
  • 에서 systemctl status apache2.service:

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 1: /etc/apache2/envvars: envvars: not found
    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: /usr/sbin/apache2ctl: 49: /etc/apache2/envvars: envvars: not found
    

내 시스템에서 이 파일에는 다음 권한이 있습니다.

$ ls -l /etc/apache2/envvars

-rw-r--r--   1 root root  1782 мар 19  2016 envvars

그리고 그 내용( $ cat /etc/apache2/envvars)은 다음과 같습니다.

# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
        SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
        SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
# temporary state file location. This might be changed to /run in Wheezy+1
export APACHE_PID_FILE=/var/run/apache2/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server mod                                               ules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1

수동으로 생성할 수 있습니다: sudo nano /etc/apache2/envvars, 위의 내용을 안에 붙여넣고 ctrl+를 저장하고 +를 o종료합니다 .ctrlx


2.시스템에서 다음 폴더 /etc/apache2/logs도 누락되었습니다.

  • 에서 journalctl -xe:

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: (2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/logs/' for main error log
    
  • 에서 systemctl status apache2.service:

    Jan 11 02:30:46 aleksandr-VirtualBox apache2[8177]: (2)No such file or directory: AH02291: Cannot access directory '/etc/apache2/logs/' for main error log
    

이는 기본 로그 폴더가 아니며 사용자 정의 구성에 정의되어 있으므로 생성해야 합니다.

$ sudo mkdir /etc/apache2/logs

답변2

사용 가능한 사이트에서 .conf 파일을 삭제하고 사이트 사용 가능에서 링크 파일을 삭제하지 않았습니다.

이제 사이트가 활성화된 모든 파일을 삭제했습니다.

apache2 서버 다시 시작 (Sudo 서비스 apache2 다시 시작)

나를 위해 일했다

이것이 누군가에게 도움이 되길 바랍니다 :)

답변3

나는 같은 문제가 있었다. 나는 같은 오류가 발생하여 sudo service apache2 restart실행했는데 sudo systemctl status apache2.service빨간색 선은Failed to start LSB: Apache2 web server.

해결책

다음 명령을 실행하십시오.

sudo apache2ctl configtest

오류(내 생각에는 구문 오류)를 확인한 다음 오류를 디버깅할 수 있습니다.

답변4

내 경우에는 다음과 같이 합니다.

Apache2 제거 및 제거

sudo service apache2 stop

sudo apt-get purge apache2

sudo apt-get autoremove

whereis apache2

sudo rm -rf /etc/apache2

아파치2 재설치

sudo apt-get install apache2

sudo apache2ctl configtest

그것은 나를 위해 실행

관련 정보