Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stopping nginx server on Mac OS X Lion once and for all

Tags:

nginx

I've tried sending the signal down nginx. I've tried killing all the processes, but they seem to just come back.

$ which nginx
/opt/local/sbin/nginx

$ sudo nginx -s stop

$ sudo /opt/local/sbin/nginx -s stop

$ ps -ef | grep nginx
141:    0 24627     1   0  2:29PM ??         0:00.00 nginx: master process /opt/local/sbin/nginx
142:   -2 24628 24627   0  2:29PM ??         0:00.02 nginx: worker process
143:   -2 24629 24627   0  2:29PM ??         0:00.07 nginx: worker process
144:   -2 24630 24627   0  2:29PM ??         0:00.07 nginx: worker process
145:   -2 24631 24627   0  2:29PM ??         0:00.07 nginx: worker process
146:   -2 24632 24627   0  2:29PM ??         0:00.07 nginx: worker process
147:   -2 24633 24627   0  2:29PM ??         0:00.07 nginx: worker process
148:   -2 24634 24627   0  2:29PM ??         0:00.07 nginx: worker process
149:   -2 24635 24627   0  2:29PM ??         0:00.07 nginx: worker process
150:   -2 24636 24627   0  2:29PM ??         0:00.07 nginx: worker process
151:   -2 24637 24627   0  2:29PM ??         0:00.07 nginx: worker process
167:    0 24924     1   0  2:36PM ??         0:00.01 /opt/local/bin/daemondo --label=nginx --start-cmd /opt/local/sbin/nginx ; --pid=fileauto --pidfile /opt/local/var/run/nginx/nginx.pid
168:    0 24925 24924   0  2:36PM ??         0:00.00 (nginx)
169:    0 24926     1   0  2:36PM ??         0:00.00 nginx: master process /opt/local/sbin/nginx
170:   -2 24927 24926   0  2:36PM ??         0:00.00 nginx: worker process
171:   -2 24928 24926   0  2:36PM ??         0:00.00 nginx: worker process
172:   -2 24929 24926   0  2:36PM ??         0:00.00 nginx: worker process
173:   -2 24930 24926   0  2:36PM ??         0:00.00 nginx: worker process
174:   -2 24931 24926   0  2:36PM ??         0:00.00 nginx: worker process
175:   -2 24932 24926   0  2:36PM ??         0:00.00 nginx: worker process
176:   -2 24933 24926   0  2:36PM ??         0:00.00 nginx: worker process
177:   -2 24934 24926   0  2:36PM ??         0:00.00 nginx: worker process
178:   -2 24935 24926   0  2:36PM ??         0:00.00 nginx: worker process
179:   -2 24936 24926   0  2:36PM ??         0:00.00 nginx: worker process
205:  502 24939 24879   0  2:36PM ttys010    0:00.00 grep -n nginx

I've already tried killing those processes, but they just show up again.

How do I stop nginx once and for all?

like image 863
user5243421 Avatar asked Jul 05 '12 21:07

user5243421


People also ask

How do I stop nginx from running on my Mac?

The correct way to do this for Nginx installed via MacPorts: Start: sudo port load nginx. Stop: sudo port unload nginx.

Where is nginx config Mac?

Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory. File locations: nginx. conf to /usr/local/etc/nginx/

Where does brew install nginx?

nginx will load all files in $(brew --prefix)/etc/nginx/servers/.


Video Answer


1 Answers

You got you answer, but just to be clear and maybe help others:

OS X should be restarting the nginx process for you (running it as a system service, which is what you want most of the time). So you need to tell launchd to stop managing this process for you with the command sudo launchctl unload <plist-filepath>, where in my case is:

sudo launchctl unload /Library/LaunchDaemons/dev.nginx.plist

like image 177
rafaelportela Avatar answered Nov 15 '22 08:11

rafaelportela