下面演示的是Mac自带的httpd服务
启动httpd服务
AppledeMacBook-Pro:python2_zh apple$ sudo apachectl start
AppledeMacBook-Pro: python2_zh apple$ ps -ef | grep httpd
0 4488 1 0 8:22下午 ?? 0:00.07 /usr/sbin/httpd -D FOREGROUND
70 4492 4488 0 8:22下午 ?? 0:00.00 /usr/sbin/httpd -D FOREGROUND
501 4494 3481 0 8:22下午 ttys000 0:00.00 grep httpd
AppledeMacBook-Pro:python2_zh apple$
关闭httpd服务
AppledeMacBook-Pro:python2_zh apple$ sudo apachectl stop
AppledeMacBook-Pro:python2_zh apple$ ps -ef | grep httpd
501 4484 3481 0 8:22下午 ttys000 0:00.00 grep httpd
重启httpd服务
AppledeMacBook-Pro:python2_zh apple$ sudo apachectl restart