
Ubuntu에서 Nginx와 OpenRusty를 모두 설정하고 있습니다. 한 가지 혼란스러운 점은 OpenRusty를 종료하고 Nginx를 중지한 후에도 여전히 nginx가 실행되는 것을 볼 수 있으며 이 프로세스를 종료할 수도 없는 것 같습니다. 제 질문은 누가 이것을 시작하느냐입니다. nginx와 왜 이 nginx 데몬이 항상 실행되고 있습니까?
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
중지하려고 systemctl을 시도했는데 nginx가 여전히 실행 중인 것 같습니다.
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
답변1
OpenResty(OpenR을 의미한다고 가정)이자형OpenR이 아닌 촌스러운유sty!)는 nginx http 데몬의 도구 세트이자 고급 구성입니다. 따라서 openresty가 실행 중이면 항상 실행 중인 nginx가 포함됩니다.
결과는 다음과 같습니다 ps -aux | grep nginx
.
...
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;
...
내 구성에는 전체 경로가 포함되어 있는 것 같지만, 그렇지 않은 경우 시도해 볼 수 있습니다( 8402
nginx의 pid로 교체).
sudo ls -l /proc/8402/exe
내 경우에는 다음과 같은 결과가 발생합니다.
lrwxrwxrwx 1 root root 0 Sep 20 16:46 /proc/8402/exe -> /usr/local/openresty/nginx/sbin/nginx
따라서 실행 중인 nginx 바이너리는 "다른" nginx가 아닌 OpenResty에서 제공됩니다. 올바른 구성 파일에 대해 혼동하지 않도록 다른 nginx를 제거하는 것을 고려할 수도 있습니다.