NGINX was built from source using the latest stable build on a debian 9 server. sudo nginx command cannot be found. The NGINX install is located in /usr/local/nginx. How can I configure my server to follow the standard sudo nginx [command] rules? I have tried adding PATH=/usr/sbin/:$PATH which did not work since NGINX is not located in sbin. Thanks
Asked
Active
Viewed 4.6k times
4
-
2Try run command `export PATH=$PATH:/usr/local/nginx/` – hcheung Oct 07 '17 at 01:29
-
If you run `which nginx`, what do you see? – hcheung Oct 07 '17 at 01:33
-
I ram the export command then which nginx and i get this response: /usr/local/nginx//nginx – Rhys Oct 07 '17 at 07:29
-
A double `//`? Anyway, you need either rename the directory if that's the case, and then make sure you sent the `export PATH` correctly corresponding to where your nginx is installed – hcheung Oct 07 '17 at 07:35
-
What is the output of `find /usr -type f -name "nginx"`? – Tarun Lalwani Oct 07 '17 at 07:38
-
The output is `/usr/local/nginx/nginx` - not sure why there is a double `//`. Any way to edit the path? – Rhys Oct 07 '17 at 07:43
1 Answers
20
Run echo $PATH
Does it contain /usr/local/sbin
?
If not then add PATH=/usr/sbin/:$PATH
to your .profile file.
Also, check that nginx is installed in /usr/local/sbin
, by going into this directory.
If not then install it by using following commands:
sudo apt update
sudo apt install nginx

Monarth Sarvaiya
- 1,041
- 8
- 20
-
2This question really belongs on SuperUser, so I've added the following fully descriptive answer on a pre-existing question there - https://superuser.com/questions/662306/nginx-v-command-not-found/1509120#1509120 – Chris Halcrow Dec 11 '19 at 05:01