Thursday, September 22, 2011

How to restart apache on Lion


Check if apache is already running:
mtsouk$ ps -ax | grep -i http
   38 ??         0:01.79 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON
   99 ??         0:00.02 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON
93322 ??         0:00.00 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON
93337 ttys000    0:00.00 grep -i http


Stop apache:
$ sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist


Check that apache is not running:
$ ps -ax | grep -i http93343 ttys000    0:00.00 grep -i http


Restart apache:
$ sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist


Check that it is running:
$ ps -ax | grep -i http
93346 ??         0:00.25 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON
93348 ??         0:00.00 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON
93350 ttys000    0:00.00 grep -i http
mtsouk$

No comments: