apachectlとapache2を使用してApacheを再起動することの違いは何ですか?


9

Apacheを再起動する3つの方法を知っています。

sudo /usr/sbin/apachectl restart

sudo /etc/init.d/apache2 restart

service apache2 restart

それぞれの方法の下で何をしますか?

私はservice apache2 stopUbuntuでの使用も試みましたが、なんらかの理由でサーバーが停止しません。localhostがデスクトップで引き続き機能します。

回答:


10

serviceおよび/またはinit.dスクリプトは、同じスクリプトを実行するものとまったく同じです。これhttpdは、主にstopおよび(re)start httpdサービスを目的としていますが、apachectlさらに多くのことができます(出力を参照)。

apachectl:

# apachectl 
Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]
                       [-C "directive"] [-c "directive"]
                       [-k start|restart|graceful|graceful-stop|stop]
                       [-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
  -S                 : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
# 

ok理由sudo / usr / sbin / apachectl restartを使用し、すべてのdjango静的ファイルが404エラーを返すため、sを要求します。サーバーの再起動の方法に関係があると考えられました
— Dr Manhattan

@DrManhattan構成ファイルを変更した可能性が高いです(おそらく書き換えを使用)。サービスを再起動するまで変更が有効にならなかったため、以前はそれに気づかなかった。
— kojow7 2018
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.