仮想ホストを設定した後、Apacheは再起動しません

仮想ホストを設定した後、Apacheは再起動しません

Webサーバーを作成しようとして仮想ホスト構成を追加した後、Apacheは再起動されません。いくつかのバグがありますが、ほとんどを修正できました。今journalctl -xn何のヒントも与えられていないので、何が起こっているのか分かりません。

ログは次のとおりです。

[root@localhost victorscarone]# systemctl restart httpd.service
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
[root@localhost victorscarone]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: failed (Result: exit-code) since vie 2015-09-11 22:54:27 PYT; 2s ago
  Process: 2681 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 2679 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 2679 (code=exited, status=1/FAILURE)

sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 11 22:54:27 localhost.localdomain kill[2681]: kill: cannot find process ""
sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 11 22:54:27 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
sep 11 22:54:27 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
[root@localhost victorscarone]# journalctl -xn
-- Logs begin at vie 2015-09-11 22:20:49 PYT, end at vie 2015-09-11 22:54:27 PYT. --
sep 11 22:48:29 localhost.localdomain kill[2658]: kill: cannot find process ""
sep 11 22:48:29 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 11 22:48:29 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 11 22:48:29 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
sep 11 22:54:27 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
--
-- Unit httpd.service has begun starting up.
sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 11 22:54:27 localhost.localdomain kill[2681]: kill: cannot find process ""
sep 11 22:54:27 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 11 22:54:27 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 11 22:54:27 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.

助けてください。良い目的のためです(私の大学の課題:D)

編集#1(2015年9月12日19:30 GMT -4)

私は何をしたのかわかりませんが、「httpd -t」コマンドをテストしてみた@garethTheRedが教えてくれて、役に立つかどうかを確認したいので、「httpd -H」を試して実行しました。その後、「apachectl restart」を実行すると同じエラーが発生しました。しかし、今回は「journalctl -xn」を見て何かが変わりました。 Apacheではまだエラーが発生しますが、テストページ123ではすでに実行されています。しかし、vhostはまだ機能していません。

以降の出力です。

[root@localhost victorscarone]# httpd -t
Syntax OK
[root@localhost victorscarone]# httpd --help
[root@localhost victorscarone]# httpd --h
httpd (pid 2977) already running
[root@localhost victorscarone]# systemctl status httpd.service
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled)
   Active: failed (Result: exit-code) since sáb 2015-09-12 19:12:42 PYT; 4min 53s ago
  Process: 2965 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 2963 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 2963 (code=exited, status=1/FAILURE)

sep 12 19:12:42 localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
sep 12 19:12:42 localhost.localdomain kill[2965]: kill: cannot find process ""
sep 12 19:12:42 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 12 19:12:42 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
sep 12 19:12:42 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost victorscarone]# apachectl restart
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
[root@localhost victorscarone]# journalctl -xn
-- Logs begin at sáb 2015-09-12 19:07:51 PYT, end at sáb 2015-09-12 19:18:32 PYT. --
sep 12 19:18:18 localhost.localdomain kill[2993]: kill: cannot find process ""
sep 12 19:18:18 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 12 19:18:18 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 12 19:18:18 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.
sep 12 19:18:32 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun with start-up
-- Defined-By: systemd
--
-- Unit httpd.service has begun starting up.
sep 12 19:18:32 localhost.localdomain httpd[3001]: httpd (pid 2977) already running
sep 12 19:18:32 localhost.localdomain kill[3003]: kill: cannot find process ""
sep 12 19:18:32 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
sep 12 19:18:32 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
--
-- Unit httpd.service has failed.
--
-- The result is failed.
sep 12 19:18:32 localhost.localdomain systemd[1]: Unit httpd.service entered failed state.

[root@localhost victorscarone]# httpd -t
Syntax OK

どんなアイデアがありますか?

編集 #2 2015年9月24日 19:29 (GMT -4) 遅れて申し訳ありません。続行する時間はありませんでしたが、もう一度起動します。 @garethTheRedが言ったことを試しましたが、ある時点で停止しました。

[root@localhost victorscarone]# httpd -DFOREGROUND -e debug
[Thu Sep 24 19:26:01.249663 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module access_compat_module from /etc/httpd/modules/mod_access_compat.so
[Thu Sep 24 19:26:01.249913 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module actions_module from /etc/httpd/modules/mod_actions.so
[Thu Sep 24 19:26:01.249975 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module alias_module from /etc/httpd/modules/mod_alias.so
[Thu Sep 24 19:26:01.250021 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module allowmethods_module from /etc/httpd/modules/mod_allowmethods.so
[Thu Sep 24 19:26:01.250065 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module auth_basic_module from /etc/httpd/modules/mod_auth_basic.so
[Thu Sep 24 19:26:01.250130 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module auth_digest_module from /etc/httpd/modules/mod_auth_digest.so
[Thu Sep 24 19:26:01.250180 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_anon_module from /etc/httpd/modules/mod_authn_anon.so
[Thu Sep 24 19:26:01.250230 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_core_module from /etc/httpd/modules/mod_authn_core.so
[Thu Sep 24 19:26:01.250277 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_dbd_module from /etc/httpd/modules/mod_authn_dbd.so
[Thu Sep 24 19:26:01.250324 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_dbm_module from /etc/httpd/modules/mod_authn_dbm.so
[Thu Sep 24 19:26:01.250368 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_file_module from /etc/httpd/modules/mod_authn_file.so
[Thu Sep 24 19:26:01.250422 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authn_socache_module from /etc/httpd/modules/mod_authn_socache.so
[Thu Sep 24 19:26:01.250484 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_core_module from /etc/httpd/modules/mod_authz_core.so
[Thu Sep 24 19:26:01.250541 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_dbd_module from /etc/httpd/modules/mod_authz_dbd.so
[Thu Sep 24 19:26:01.250597 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_dbm_module from /etc/httpd/modules/mod_authz_dbm.so
[Thu Sep 24 19:26:01.250650 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_groupfile_module from /etc/httpd/modules/mod_authz_groupfile.so
[Thu Sep 24 19:26:01.250701 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_host_module from /etc/httpd/modules/mod_authz_host.so
[Thu Sep 24 19:26:01.250857 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_owner_module from /etc/httpd/modules/mod_authz_owner.so
[Thu Sep 24 19:26:01.250914 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module authz_user_module from /etc/httpd/modules/mod_authz_user.so
[Thu Sep 24 19:26:01.250986 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module autoindex_module from /etc/httpd/modules/mod_autoindex.so
[Thu Sep 24 19:26:01.251082 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module cache_module from /etc/httpd/modules/mod_cache.so
[Thu Sep 24 19:26:01.251370 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module cache_disk_module from /etc/httpd/modules/mod_cache_disk.so
[Thu Sep 24 19:26:01.251431 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module data_module from /etc/httpd/modules/mod_data.so
[Thu Sep 24 19:26:01.251498 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dbd_module from /etc/httpd/modules/mod_dbd.so
[Thu Sep 24 19:26:01.251662 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module deflate_module from /etc/httpd/modules/mod_deflate.so
[Thu Sep 24 19:26:01.251805 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dir_module from /etc/httpd/modules/mod_dir.so
[Thu Sep 24 19:26:01.251873 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dumpio_module from /etc/httpd/modules/mod_dumpio.so
[Thu Sep 24 19:26:01.251929 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module echo_module from /etc/httpd/modules/mod_echo.so
[Thu Sep 24 19:26:01.251985 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module env_module from /etc/httpd/modules/mod_env.so
[Thu Sep 24 19:26:01.252044 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module expires_module from /etc/httpd/modules/mod_expires.so
[Thu Sep 24 19:26:01.252113 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module ext_filter_module from /etc/httpd/modules/mod_ext_filter.so
[Thu Sep 24 19:26:01.252184 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module filter_module from /etc/httpd/modules/mod_filter.so
[Thu Sep 24 19:26:01.252309 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module headers_module from /etc/httpd/modules/mod_headers.so
[Thu Sep 24 19:26:01.252392 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module include_module from /etc/httpd/modules/mod_include.so
[Thu Sep 24 19:26:01.252475 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module info_module from /etc/httpd/modules/mod_info.so
[Thu Sep 24 19:26:01.252547 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module log_config_module from /etc/httpd/modules/mod_log_config.so
[Thu Sep 24 19:26:01.252611 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module logio_module from /etc/httpd/modules/mod_logio.so
[Thu Sep 24 19:26:01.252684 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module mime_magic_module from /etc/httpd/modules/mod_mime_magic.so
[Thu Sep 24 19:26:01.252822 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module mime_module from /etc/httpd/modules/mod_mime.so
[Thu Sep 24 19:26:01.252916 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module negotiation_module from /etc/httpd/modules/mod_negotiation.so
[Thu Sep 24 19:26:01.252985 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module remoteip_module from /etc/httpd/modules/mod_remoteip.so
[Thu Sep 24 19:26:01.253050 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module reqtimeout_module from /etc/httpd/modules/mod_reqtimeout.so
[Thu Sep 24 19:26:01.253150 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module rewrite_module from /etc/httpd/modules/mod_rewrite.so
[Thu Sep 24 19:26:01.253219 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module setenvif_module from /etc/httpd/modules/mod_setenvif.so
[Thu Sep 24 19:26:01.253303 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module slotmem_plain_module from /etc/httpd/modules/mod_slotmem_plain.so
[Thu Sep 24 19:26:01.253373 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module slotmem_shm_module from /etc/httpd/modules/mod_slotmem_shm.so
[Thu Sep 24 19:26:01.253440 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module socache_dbm_module from /etc/httpd/modules/mod_socache_dbm.so
[Thu Sep 24 19:26:01.253503 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module socache_memcache_module from /etc/httpd/modules/mod_socache_memcache.so
[Thu Sep 24 19:26:01.253567 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module socache_shmcb_module from /etc/httpd/modules/mod_socache_shmcb.so
[Thu Sep 24 19:26:01.253638 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module status_module from /etc/httpd/modules/mod_status.so
[Thu Sep 24 19:26:01.253747 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module substitute_module from /etc/httpd/modules/mod_substitute.so
[Thu Sep 24 19:26:01.253823 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module suexec_module from /etc/httpd/modules/mod_suexec.so
[Thu Sep 24 19:26:01.253884 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module unique_id_module from /etc/httpd/modules/mod_unique_id.so
[Thu Sep 24 19:26:01.253960 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module unixd_module from /etc/httpd/modules/mod_unixd.so
[Thu Sep 24 19:26:01.254028 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module userdir_module from /etc/httpd/modules/mod_userdir.so
[Thu Sep 24 19:26:01.254094 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module version_module from /etc/httpd/modules/mod_version.so
[Thu Sep 24 19:26:01.254157 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module vhost_alias_module from /etc/httpd/modules/mod_vhost_alias.so
[Thu Sep 24 19:26:01.254350 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dav_module from /etc/httpd/modules/mod_dav.so
[Thu Sep 24 19:26:01.254491 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dav_fs_module from /etc/httpd/modules/mod_dav_fs.so
[Thu Sep 24 19:26:01.255042 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module dav_lock_module from /etc/httpd/modules/mod_dav_lock.so
[Thu Sep 24 19:26:01.255892 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lua_module from /etc/httpd/modules/mod_lua.so
[Thu Sep 24 19:26:01.256053 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module mpm_prefork_module from /etc/httpd/modules/mod_mpm_prefork.so
[Thu Sep 24 19:26:01.256261 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_module from /etc/httpd/modules/mod_proxy.so
[Thu Sep 24 19:26:01.256362 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_bybusyness_module from /etc/httpd/modules/mod_lbmethod_bybusyness.so
[Thu Sep 24 19:26:01.256434 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_byrequests_module from /etc/httpd/modules/mod_lbmethod_byrequests.so
[Thu Sep 24 19:26:01.256505 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_bytraffic_module from /etc/httpd/modules/mod_lbmethod_bytraffic.so
[Thu Sep 24 19:26:01.256709 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module lbmethod_heartbeat_module from /etc/httpd/modules/mod_lbmethod_heartbeat.so
[Thu Sep 24 19:26:01.256904 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_ajp_module from /etc/httpd/modules/mod_proxy_ajp.so
[Thu Sep 24 19:26:01.257042 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_balancer_module from /etc/httpd/modules/mod_proxy_balancer.so
[Thu Sep 24 19:26:01.257142 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_connect_module from /etc/httpd/modules/mod_proxy_connect.so
[Thu Sep 24 19:26:01.257227 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_express_module from /etc/httpd/modules/mod_proxy_express.so
[Thu Sep 24 19:26:01.257334 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_fcgi_module from /etc/httpd/modules/mod_proxy_fcgi.so
[Thu Sep 24 19:26:01.257421 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_fdpass_module from /etc/httpd/modules/mod_proxy_fdpass.so
[Thu Sep 24 19:26:01.257543 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_ftp_module from /etc/httpd/modules/mod_proxy_ftp.so
[Thu Sep 24 19:26:01.257736 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_http_module from /etc/httpd/modules/mod_proxy_http.so
[Thu Sep 24 19:26:01.257861 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module proxy_scgi_module from /etc/httpd/modules/mod_proxy_scgi.so
[Thu Sep 24 19:26:01.258128 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module systemd_module from /etc/httpd/modules/mod_systemd.so
[Thu Sep 24 19:26:01.258301 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module cgi_module from /etc/httpd/modules/mod_cgi.so
[Thu Sep 24 19:26:01.272364 2015] [so:debug] [pid 2603] mod_so.c(266): AH01575: loaded module php5_module from /etc/httpd/modules/libphp5.so

答え1

同様の問題がありましたが、ApacheはVirtualHostコンテナのErrorLogとCustomLog行が好きではないことがわかりました。私はそれらをコメントアウトし、サービスは問題なく開始されました。

私はこれがhttpd.confの権限に関連していると思います。

答え2

今後この問題が発生する場合は、SElinuxを無効にしないで使用方法を学んでください。これを無効にすることは、銃を撃ちようとするとトリガーが機能しないため、銃のすべての安全装置を取り外すのとほぼ同じです。

この問題を解決する正しい方法は次のとおりです。

semanage fcontext -a httpd_sys_rw_content_t "/var/www/html(/.*)?"

指定されたディレクトリへの読み書きに対するApache権限を許可します。

その後、次のことができるはずです。restorecon -Rv /var/www/html

これにより問題が解決します。

@MADforFUNandHappyによる投稿

答え3

システム全体を再起動しようとしましたが、存在しなくなったプロセスを終了したいようです。

sudo reboot

システムが完全に再起動したら、コマンドを再実行してみてください。

sudo systemctl restart httpd

動作する必要があります。そうでない場合は、「journalctl -xn」出力を投稿してください。

答え4

私にとっては、CentOS7でselinuxを無効にすることで達成されました。

再起動後に永久に無効にするには:

sudo nano/etc/selinux/config

SELINUX=許可または無効

文書を保存

sudo setenforce 0

そして確認

状態

関連情報