重启Apache服务

Synopsis

When acting in pass-through mode, apachectl can take all the arguments available for the httpdbinary.

apachectl [httpd-argument]

When acting in SysV init mode, apachectl takes simple, one-word commands, defined below.

apachectl command

Options

Only the SysV init-style options are defined here.  Other arguments are defined on the httpd manual page.

  • start

  • Start the Apache httpd daemon.  Gives an error if it is already running.  This is equivalent to apachectl -k start.

  • stop

  • Stops the Apache httpd daemon.  This is equivalent toapachectl -k stop.

  • restart

  • Restarts the Apache httpd daemon.  If the daemon is not running, it is started.  This command automatically checks the configuration files as in configtest before initiating the restart to make sure the daemon doesn't die.  This is equivalent to apachectl -k restart.

  • fullstatus

  • Displays a full status report from mod_status. For this to work, you need to have mod_status enabled on your server and a text-based browser such as lynxavailable on your system.  The URL used to access the status report can be set by editing the STATUSURL variable in the script.

  • status

  • Displays a brief status report.  Similar to thefullstatus option, except that the list of requests currently being served is omitted.

  • graceful

  • Gracefully restarts the Apache httpd daemon.  If the daemon is not running, it is started.  This differs from a normal restart in that currently open connections are not aborted.  A side effect is that old log files will not be closed immediately.  This means that if used in a log rotation script, a substantial delay may be necessary to ensure that the old log files are closed before processing them.  This command automatically checks the configuration files as in configtest before initiating the restart to make sure Apache doesn't die.  This is equivalent toapachectl -k graceful.

  • graceful-stop

  • Gracefully stops the Apache httpd daemon.   This differs from a normal stop in that currently open connections are not aborted.  A side effect is that old log files will not be closed immediately. This is equivalent to apachectl -k graceful-stop.

  • configtest

  • Run a configuration file syntax test. It parses the configuration files and either reports Syntax Okor detailed information about the particular syntax error.  This is equivalent to apachectl -t.

The following option was available in earlier versions but has been removed.

  • startssl

To start httpd with SSL support, you should edit your configuration file to include the relevant directives and then use the normal apachectl start.


需要重启Apache服务时,有多种方法:
1.apachectl -k graceful
    优雅的重启,父进程将会等待子进程。
2.apachectl -k restart
    立即重启

主要是graceful

---完美的重起--我推荐每次重起都用它不用restart--

它与restart的不同可以写一篇文章

--概括的说restart向apache主进程发送一个SIGHUP信号--而graceful发的是SIGUSER

1信号

--发送HUP信号给主进程将导致结束它的子进程, 就像TERM(stop)信号一样,但是主进程将不会终止. 它将重新读取配置文件, 并且重新打开所有的日志文件. 然后重新产生所有子进程并继续为点击操作提供服务.

而USR1 信号引起主进程处理并警告收到当前请求之后的子进程结束(或在它们不做任何服务时立刻结束). 主进程将重新读取它的配置文件并打开它的日志文件. 当每一个子进程结束后,主进程将使用配置信息产生一个新的子进程来立刻响应请求并为之服务.

--好象挺复杂的是吧

--主要是知道graceful要比restart 好就行了



查看apache是否起来 可以在你的shell里面输入 :

ps ax | grep apache


Apache参考文档:

http://httpd.apache.org/docs/2.2/stopping.html


转载于:https://my.oschina.net/ajian2014/blog/305203

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值