Answers:
由于Apache在80
被认为是敏感系统级端口的保留端口()上运行,因此您必须apachectl restart
通过sudo
以下方式运行:
sudo apachectl -k restart
键入后,它将作为您的密码。假设您具有管理员权限,只需输入密码,Apache应该重新启动。其他命令包括start
和stop
可以运行这样启动Apache:
sudo apachectl -k start
像这样停止Apache:
sudo apachectl -k stop
同样,如果您只是apachectl
不输入任何内容,您将收到可与apachectl
命令一起使用的选项和指令列表。这是我从Mac OS X 10.9.5的输出:
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] [-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
-T : start without DocumentRoot(s) check