------------ On CentOS/RHEL ------------
$ sudo systemctl reload httpd [On Systemd]
$ sudo service httpd reload [On SysVInit]
------------ On Ubunt/Debian ------------
$ sudo systemctl reload apache2 [On Systemd]
$ sudo service apache2 reload [On SysVInit]
停止Apache服务
要停止Apache服务,请使用以下命令。
------------ On CentOS/RHEL ------------
$ sudo systemctl stop httpd [On Systemd]
$ sudo service httpd stop [On SysVInit]
------------ On Ubunt/Debian ------------
$ sudo systemctl stop apache2 [On Systemd]
$ sudo service apache2 stop [On SysVInit]
显示Apache命令帮助
最后但并非最不重要的是,您可以通过运行以下命令获得有关systemd下的Apache服务命令的帮助。
$ sudo httpd -h
或者
$ sudo apache2 -h
或者
$ systemctl -h apache2
输出示例
Usage: httpd [-D name] [-d directory] [-f file]
[-C "directive"] [-c "directive"]
[-k start|restart|graceful|graceful-stop|stop]
[-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
-D name : define a name for use in 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 vhost settings
-t -D DUMP_RUN_CFG : show parsed run settings
-S : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
-t -D DUMP_MODULES : show all loaded modules
-M : a synonym for -t -D DUMP_MODULES
-t : run syntax check for config files
-T : start without DocumentRoot(s) check
-X : debug mode (only one worker, do not detach)
就这样了! 在本文中,我们已经解释了您应该了解的最常用的Apache/HTTPD服务管理命令,包括启动,启用,重新启动和停止Apache。 如有任何问题或意见,您可以随时通过下面的反馈表联系我们。
如何在Ubuntu 18.04上安装和配置Apache 2 Web服务器 https://www.linuxidc.com/Linux/2018-11/155507.htm
Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx