Câu trả lời:
Vì Apache chạy trên một cổng dành riêng ( 80) được coi là cổng cấp độ hệ thống nhạy cảm, bạn sẽ phải chạyapachectl restart qua sudonhư thế này:
sudo apachectl -k restart
Sau khi gõ nó trong đó sẽ như bạn cho mật khẩu của bạn. Giả sử bạn có quyền quản trị viên, chỉ cần nhập mật khẩu và Apache sẽ khởi động lại. Các lệnh khác bao gồm startvàstop có thể chạy như thế này để khởi động Apache:
sudo apachectl -k start
Và như thế này để ngăn chặn Apache:
sudo apachectl -k stop
Ngoài ra, nếu bạn chỉ cần nhập apachectlmà không có gì, bạn sẽ nhận được một danh sách các tùy chọn và chỉ thị bạn có thể sử dụng với apachectllệnh; đây là đầu ra của tôi từ 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