~ / archivo / stackoverflow / 51145258
stopped httpd but localhost still bind to 0.0.0.0:80
StackOverflow
· apache, homebrew
· ayudé
-
user9728810 pregunta 2018-07-03 00:41
I use brew to install
httpd, I stopped the service usingbrew services stop httpdthen I visit locahost, I still can see apache is running?- Matt Clark 2018-07-03 00:53 Can you try using:
sudo netstat -lp | grep 80this will show you the PID of the process that has the port bound. If this is not apache, kill it. If this is apache, kill it ;) Try usingsudo apachectl stop, or justkill -9 <thePID> - Miguel Ortiz yo 2018-07-03 00:55 Check if the service is running:
pgrep -fl httpd. If it is probably is stuck. Try killing the instance with:pkill -f httpdorpkill -f apache2. If those don't work, trykill -9 <PID>(You'll obtain the PID of the process from the first command). - user9728810 2018-07-03 00:58 @MattClark netstat: option requires an argument -- p
- user9728810 2018-07-03 00:59 @MiguelOrtiz I got bunch of these
97 /usr/sbin/httpd -D FOREGROUND 276 /usr/sbin/httpd -D FOREGROUND 902 /usr/sbin/httpd -D FOREGROUND 903 /usr/sbin/httpd -D FOREGROUND 904 /usr/sbin/httpd -D FOREGROUND 2009 /usr/sbin/httpd -D FOREGROUNDWhat are they? are they started themselves? - Miguel Ortiz yo 2018-07-03 01:00 @Melissa92, you have several instances of the process running (probably parent and childs) try kill each of them until there's no one.
- user9728810 2018-07-03 01:00 @MiguelOrtiz I killed httpd, but they appear again when I run
pgrep -fl httpd - Matt Clark 2018-07-03 01:00 Ugh, of course OSX has to be different then every other OS in existence.... How about this one?
netstat -anv - Miguel Ortiz yo 2018-07-03 01:00 @Melissa92 you must kill all the instances (parent and childs).
- Matt Clark 2018-07-03 01:01
killall httpd, did you try runningsudo apachectl stop? - Matt Clark 2018-07-03 01:01 If you see many children, use
ps aux | grep httpdto see a list of all running httpd processes, Runkill -9 <thePID>on the lowest number from the previous output. - user9728810 2018-07-03 01:05 what is the pid for my result? pastebin.com/ZAxvFSay
I run ps aux | grep httpd - Miguel Ortiz yo 2018-07-03 01:22 @Melissa92 It should be then
kill -9 3110andkill -9 3109You have two instances running, one with root (probably you used sudo) and the other one with www user. - user9728810 2018-07-03 01:25 another port appear after the kill
- Miguel Ortiz yo 2018-07-03 01:40 @Melissa92 attach the output of
ps aux | grep httpdafter killing the processes o - user9728810 2018-07-03 01:46 _www 3356 0.0 0.0 2455088 704 ?? S 9:25AM 0:00.00 /usr/sbin/httpd -D FOREGROUND root 3355 0.0 0.0 2455344 3588 ?? Ss 9:25AM 0:00.14 /usr/sbin/httpd -D FOREGROUND private.laptop 3967 0.0 0.0 2444068 816 s004 S+ 9:46AM 0:00.00 grep httpd
- Miguel Ortiz yo 2018-07-03 01:52 @Melissa92 I've elaborated an answer for you.
- Matt Clark 2018-07-03 00:53 Can you try using:
-
Davide respuesta 2018-07-03 00:46
You need to give following command:
service httpd stop- Davide 2018-07-03 00:49 Which OS are you using?
- Matt Clark 2018-07-03 00:51
brewdoesn't give you a clue? OSX. - Davide 2018-07-03 00:53 I didn't think about it. Then try /usr/sbin/apachectl stop
-
You must kill the processes. As I can see from your comment you are running
httpdas the userswwwandroot:_www 3356 0.0 0.0 2455088 704 ?? S 9:25AM 0:00.00 /usr/sbin/httpd -D FOREGROUND root 3355 0.0 0.0 2455344 3588 ?? Ss 9:25AM 0:00.14 /usr/sbin/httpd -D FOREGROUND private.laptop 3967 0.0 0.0 2444068 816 s004 S+ 9:46AM 0:00.00 grep httpdThe first column represent the
userand the second column the process ID orPID.Try running:
sudo kill -9 3356 sudo kill -9 3355After each execution verify the services dissapear using
ps aux | grep httpdThe last proccess
private.laptopisn't related to your problem so no need to kill it.If your problem isn't solved by this, maybe a daemon is executing your httpd, please refeer to this.
- user9728810 2018-07-03 01:53 I got this after killing _www 4018 0.0 0.0 2455088 720 ?? S 9:53AM 0:00.00 /usr/sbin/httpd -D FOREGROUND root 4017 0.0 0.0 2455344 3580 ?? Ss 9:53AM 0:00.11 /usr/sbin/httpd -D FOREGROUND
- user9728810 2018-07-03 01:53 It will reappear after the killing.
- Miguel Ortiz yo 2018-07-03 01:56 @Melissa92 yes, probably a daemon auto starting your httpd, please check the updated answer.