I have a problem with nginx, doing:

nginx -t

i get -bash: nginx: command not found

root@vpslive /# find /usr/ -name 'nginx'

the nginx server is running, i'm afraid I'll have problems when I restart

how can i solve?

ps -aux

enter image description here

seems /usr/sbin/nginx has been deleted!! i have some problems if i restart nginx right? thanks

pstree -p

enter image description here

enter image description here

closed as off-topic by Tero Kilkanen, kubanczyk, Magellan, fuero, Jenny D Aug 15 '18 at 6:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • Are you sure nginx is running try ps aux | grep nginx to check if it running first. If it running try to locate directory it is install in. It is very hard to help you when you dont state what is your config and what system you are running on – Ahmed Jul 17 '18 at 9:15
  • i have updated the question. nginx seems runnin on /usr/sbin/nginx but this file doesn't exists – Augusto Murri Jul 17 '18 at 9:24
  • Try cd /usr/sbin/nginx then try nginx status or ./nginx status nginx -t checks if your config file is right or wrong . The question is what do you want to do with nginx -t – Ahmed Jul 17 '18 at 9:32
  • /usr/sbin/nginx -bash: /usr/sbin/nginx: No such file or directory – Augusto Murri Jul 17 '18 at 9:32
  • try /usr/sbin then nginx -t – Ahmed Jul 17 '18 at 9:37


nginx package in the system was uninstalled. Reinstalling the package resolves the issue.

Do a ps -eF | grep nginx, and note the PID; then do a ls -a /proc/{PID}/exe.

/proc/{PID}/exe should be a symbolic link to the executable file run with said PID.

  • ls -la /proc/16348/exe lrwxrwxrwx 1 www-data www-data 0 Jul 14 12:11 /proc/16348/exe -> /usr/sbin/nginx (deleted) – Augusto Murri Jul 17 '18 at 9:51
  • try running /usr/sbin/nginx -t then – mforsetti Jul 17 '18 at 9:53
  • /usr/sbin/nginx -t -bash: /usr/sbin/nginx: No such file or directory – Augusto Murri Jul 17 '18 at 9:56
  • that's funny, either you're running a container (docker/lxd/openvz) or you got something very weird with your system (rootkit?). Can you show us your pstree -p output? – mforsetti Jul 17 '18 at 10:03
  • updated with screenshot... no a simple webserver debian based nginx php7 mysql for running one (important) website – Augusto Murri Jul 17 '18 at 10:19

If your nginx service is running on port 80. you can get nginx binary path from available running process.

# lsof -i :80

It will give the process ID of nginx. then find nginx binary path from the output of

# lsof -i -p PID_from_last_commond | grep nginx

Alternatively, you can search nginx binary on a server with "locate" command

# locate nginx

Note: you need to install and update locate command if not present on server.

  • nginx 1097 root txt REG 8,1 1004952 811 /usr/sbin/nginx (deleted) – Augusto Murri Jul 17 '18 at 9:34
  • try to locate nginx binary is present on server or not." # locate nginx ". If it is present just kill all the running nginx service /process and start nginx again. – Sunil Bhoi Jul 17 '18 at 10:09
  • locate nginx doesn't find nothing – Augusto Murri Jul 17 '18 at 10:16
  • Try to update locate backend db "#updatedb" is the command. and then search "#locate nginx". If still there is no nginx binary. Then it means binary got deleted from server. It is serious things. Take a backup of all the configuration and document root folder. Reinstall nginx package. ( remove available packges if conflicts" and start the service. – Sunil Bhoi Jul 17 '18 at 10:20
  • i don't know how... /usr/sbin/nginx has been deleted – Augusto Murri Jul 17 '18 at 10:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.