Apache、LSBの起動に失敗した問題:Apache2 Webサーバー


11

私はUbuntu 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が起動し始めました。
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]:* Apache httpd Webサーバーapache2を起動
1月11日02:30:46 aleksandr-VirtualBox apache2 [8177]:*
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:* apache2 configtestが失敗しました。
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:構成テストの出力は次のとおりでした:
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
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:(2)そのようなファイルまたはディレクトリはありません:AH02291:メインエラーログのディレクトリ '/ etc / apache2 / logs /'にアクセスできません
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:AH00014:構成チェックに失敗しました
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:アクション 'configtest'が失敗しました。
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:Apacheエラーログに詳細が記録されている可能性があります。
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:制御プロセスが終了しました、コード=終了ステータス= 1
1月11日02:30:46 aleksandr-VirtualBox sudo [8171]:pam_unix(sudo:session):セッションはユーザーrootに対して閉じられました
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:LSBの開始に失敗しました:Apache2 Webサーバー。
-件名:ユニットapache2.serviceが失敗しました
-定義者:systemd
-サポート:http://lists.freedesktop.org/mailman/listinfo/systemd-devel
- 
-ユニットapache2.serviceが失敗しました。
- 
-結果は失敗します。
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:ユニットは障害状態に入りました。
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:結果「exit-code」で失敗しました。
Jan 11 02:33:09 aleksandr-VirtualBox dhclient [792]:DHCPREQUEST of 192.168.56.101 on enp0s8 to 192.168.56.100 port 67(xid = 0x204f076f)
Jan 11 02:33:09 aleksandr-VirtualBox dhclient [792]:192.168.56.100からの192.168.56.101のDHCPACK
Jan 11 02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4253]アドレス192.168.56.101
Jan 11 02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4260] plen 24(255.255.255.0)
Jan 11 02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4266]サーバー識別子192.168.56.100
Jan 11 02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4273]リース時間1200
Jan 11 02:33:09 aleksandr-VirtualBox NetworkManager [619]:[1484073189.4279] dhcp4(enp0s8):state changed bound-> bound
Jan 11 02:33:09 aleksandr-VirtualBox dbus [590]:[system] systemdを介してアクティブ化:service name = 'org.freedesktop.nm_dispatcher' unit = 'dbus-org.freedesktop.nm-dispatcher.service'
Jan 11 02:33:09 aleksandr-VirtualBox systemd [1]:Network Manager Script Dispatcher Serviceを開始しています...
-件名:ユニットNetworkManager-dispatcher.serviceが起動を開始しました
-定義者:systemd
-  サポート: 
- 
-Unit 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の起動が完了しました。
- 
-起動結果ができました。
Jan 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 Webサーバー
   ロード済み:ロード済み(/etc/init.d/apache2;不良;ベンダープリセット:有効)
  ドロップイン:/lib/systemd/system/apache2.service.d
           `-apache2-systemd.conf
   アクティブ:失敗(結果:終了コード)2017-01-11水02:30:46 +08; 33分前
     ドキュメント:man:systemd-sysv-generator(8)
  プロセス:8023 ExecStop = / etc / init.d / apache2 stop(code = exited、status = 0 / SUCCESS)
  プロセス:2236 ExecReload = / etc / init.d / apache2 reload(code = exited、status = 0 / SUCCESS)
  プロセス:8177 ExecStart = / etc / init.d / apache2 start(code = exited、status = 1 / FAILURE)

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
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:(2)そのようなファイルまたはディレクトリはありません:AH02291:メインエラーログのディレクトリ '/ etc / apache2 / logs /'にアクセスできません
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:AH00014:構成チェックに失敗しました
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:アクション 'configtest'が失敗しました。
Jan 11 02:30:46 aleksandr-VirtualBox apache2 [8177]:Apacheエラーログに詳細が記録されている可能性があります。
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:制御プロセスが終了しました、コード=終了ステータス= 1
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:LSBの開始に失敗しました:Apache2 Webサーバー。
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:ユニットは障害状態に入りました。
Jan 11 02:30:46 aleksandr-VirtualBox systemd [1]:apache2.service:結果「exit-code」で失敗しました。

なにが問題ですか?割り込みはどこにありますか?助けてください!

回答:


8

2つのエラーがあります。


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と出口ctrl+ x


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

あなたが書いたように私はやった。残念ながら、エラーはまだ存在します:(したがって検索を続行します
A.Verber

@ A.Verberまだ同じエラーですか、何か変更されましたか?
pa4080 2017年

1
@ A.Verber私はもう一度あなたの質問を見ました。システムにディレクトリ/etc/apache2/logs/が存在しますか?これは2番目のエラーメッセージであるためです。試すことができsudo mkdir /etc/apache2/logsます。
pa4080 2017年

1
はい!ログディレクトリを作成した後、エラーが消えました!ありがとう
A.Verber 2017年

5

私はサイトで.confファイルを削除しましたが、サイトではリンクファイルを削除していません。

今、私はサイト対応のすべてのファイルを削除しました

apache2サーバーを再起動しました(sudo service apache2 restart)

私のために働いた

これが誰かを助けるかもしれないことを願っています:)


助けて頂きました!thx ..
私は一度クマと

5

私も同じ問題を抱えていました。同じエラーが発生しsudo service apache2 restartて実行さsudo systemctl status apache2.serviceれ、赤い線がFailed to start LSB: Apache2 web server.

解決

次のコマンドを実行します。

sudo apache2ctl configtest

エラー(構文エラーだと思います)をチェックし、エラーをデバッグできます。


あなたの解決策は私のapache2問題を解決するのに役立ちました、ありがとう。
S1awek、

4

次のコマンドを試してください:

sudo a2dismod mpm_event
sudo a2enmod mpm_prefork

次に、apache2サービスを再起動します。


sudo a2dismod mpm_event sudo a2enmod mpm_prefork
Arnauld

0

私の場合、これを行います:

Apache2をアンインストールして削除する

sudo service apache2 stop

sudo apt-get purge apache2

sudo apt-get autoremove

whereis apache2

sudo rm -rf /etc/apache2

apache2を再インストールします

sudo apt-get install apache2

sudo apache2ctl configtest

私のために走る

弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.