skip to Main Content

I tried systemctl status nginx
and got

 Unit nginx.service could not be found.

The server is currently running nginx

I use ps -ef | grep nginx
and it returns info of nginx

root      6475  4292  0 16:58 pts/0    00:00:00 grep --color=auto nginx
nobody   31104 31334  0 Apr01 ?        00:00:13 nginx: worker process
root     31334     1  0 Jan25 ?        00:00:00 nginx: master process /usr/local/nginx-1.20.2/sbin/nginx -c /usr/local/nginx-1.20.2/conf/nginx.conf

how to restart this nginx?

2

Answers


  1. Chosen as BEST ANSWER

    I found how to do it

    ps -ef|grep nginx
    

    find process of nginx

    then kill all these process

    then

    /usr/local/nginx/sbin/nginx -c /usr/local/nginx-1.20.2/conf/nginx.conf
    

    -c /usr/local/nginx-1.20.2/conf/nginx.conf is the config file option


  2. Seems, like you lost your nginx.service file (basically, located in /lib/systemd/system/nginx.service).
    Try to reinstall nginx:

    sudo apt-get purge nginx nginx-common nginx-full  
    sudo apt-get install nginx
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search