Score:0

Cannot kill - nginx: master process nginx -g daemon off

mc flag
Jia

I am setting up both Nginx and OpenRusty on my Ubuntu , one thing confuses me is , even after I quit OpenRusty and stop Nginx , I can still observe a nginx running , seems like this process cannot even be killed , My question is who launch this nginx and why this nginx daemon is always running ?

ps -aux | grep nginx
root      3779  0.0  0.0  10776  6180 ?        Ss   06:57   0:00 **nginx: master process nginx -g daemon off;**
systemd+  4587  0.0  0.0  11172  2756 ?        S    06:57   0:00 nginx: worker process
jia      17315  0.0  0.0  16184  1068 pts/0    S+   07:08   0:00 grep --color=auto nginx

I tried systemctl to stop it , seems nginx still running

sudo systemctl stop nginx.service
 
 sudo systemctl status nginx.service 
● nginx.service - The NGINX HTTP and reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

 sudo ps -aux | grep nginx root 3779 0.0 0.0 10776 6180 ? Ss 06:57 0:00 nginx: master process nginx -g daemon off; 
    systemd+ 4587 0.0 0.0 11172 2756 ? S 06:57 0:00 nginx: worker process
djdomi avatar
za flag
how's about to use `kill 3779 4587`? or the Terminator Style: `kill -9 3779 4587`
Jia avatar
mc flag
Jia
neither works , I tried both , after I killed them , new nginx boot up again
Score:1
ru flag

OpenResty (assumed you meant OpenResty and not OpenRusty!) is a toolset and an advanced configuration of nginx's http daemon. So it will always include a running nginx if openresty is running.

So for me your ps -aux | grep nginx results in:

...
root      8402  0.0  0.0  49984 14580 ?        SNs  Jul25   0:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx -g daemon on; master_process on;
...

My config seems to include the full path, but if yours doesn't, you could try (replace 8402 with your nginx's pid):

sudo ls -l /proc/8402/exe

what, in my case, results in:

lrwxrwxrwx 1 root root 0 Sep 20 16:46 /proc/8402/exe -> /usr/local/openresty/nginx/sbin/nginx

So the running nginx binary comes from OpenResty and not the "other" nginx. You might also consider removing the other nginx to not getting confused about the correct config files...

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.