Since today: bash: nginx: command not found

New to Debian (Or Linux in general)? Ask your questions here!

Since today: bash: nginx: command not found

Postby Chris8087 » 2020-02-13 06:48

Hello,

I've setup a fresh Debian 10 VPS with a LEMP and installed a first domain/vhost with Nginx.
Yesterday nginx -t as root worked well and I was able to test the vhost / server blocks files.

Today I get:
nginx -t
bash: nginx: command not found

locate nginx
bash: locate: command not found

systemctl reload nginx
that is working without any issues.
The websites are working fine as well.

What could that be?
Chris8087
 
Posts: 17
Joined: 2014-11-13 10:35

Re: Since today: bash: nginx: command not found

Postby Chrisdb » 2020-02-13 07:29

you have to run nginx as 'sudo'

why did you configure nginx as root?
Chrisdb
 
Posts: 226
Joined: 2018-04-10 07:16

Re: Since today: bash: nginx: command not found

Postby Chris8087 » 2020-02-13 08:16

I haven't installed sudo so far .. only used the VPS as root for the config stuff and then as a normal user for uploading websites etc.

Still .. the question remains, why did it work yesterday and not today?
Chris8087
 
Posts: 17
Joined: 2014-11-13 10:35

Re: Since today: bash: nginx: command not found

Postby Chrisdb » 2020-02-13 08:49

Not clear how you're running the 'nginx' command. As normal user or root?

EDIT: what's the output of:
Code: Select all
aptitude search 'nginx ~i'
Chrisdb
 
Posts: 226
Joined: 2018-04-10 07:16

Re: Since today: bash: nginx: command not found

Postby Chris8087 » 2020-02-13 09:07

As either user, I get the same result (not found).
But usually as root (login via SSH as normal user, su into root account, nginx -t)

Code: Select all
aptitude search 'nginx ~i'
bash: aptitude: command not found

apt list --installed "*nginx*"
Listing... Done
libnginx-mod-http-auth-pam/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-dav-ext/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-echo/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-geoip/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-image-filter/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-subs-filter/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-upstream-fair/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-http-xslt-filter/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-mail/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
libnginx-mod-stream/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
nginx-common/stable,stable,now 1.14.2-2+deb10u1 all [installed,automatic]
nginx-full/stable,stable,now 1.14.2-2+deb10u1 amd64 [installed,automatic]
nginx/stable,stable,now 1.14.2-2+deb10u1 all [installed]

systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-02-13 08:18:58 CET; 2h 34min ago
     Docs: man:nginx(8)
  Process: 707 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 708 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 1321 ExecReload=/usr/sbin/nginx -g daemon on; master_process on; -s reload (code=exited, status=0/SUCCESS)
 Main PID: 709 (nginx)
    Tasks: 5 (limit: 4915)
   Memory: 19.1M
   CGroup: /system.slice/nginx.service
           ├─ 709 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           ├─1322 nginx: worker process
           ├─1323 nginx: worker process
           ├─1324 nginx: worker process
           └─1325 nginx: worker process

Feb 13 10:02:44 examplesrv.net systemd[1]: Reloading A high performance web server and a reverse proxy server.
Feb 13 10:02:44 examplesrv.net systemd[1]: Reloaded A high performance web server and a reverse proxy server.
Feb 13 10:08:09 examplesrv.net systemd[1]: Reloading A high performance web server and a reverse proxy server.
Feb 13 10:08:09 examplesrv.net systemd[1]: Reloaded A high performance web server and a reverse proxy server.
Feb 13 10:31:36 examplesrv.net systemd[1]: Reloading A high performance web server and a reverse proxy server.
Feb 13 10:31:36 examplesrv.net systemd[1]: Reloaded A high performance web server and a reverse proxy server.
Feb 13 10:32:58 examplesrv.net systemd[1]: Reloading A high performance web server and a reverse proxy server.
Feb 13 10:32:58 examplesrv.net systemd[1]: Reloaded A high performance web server and a reverse proxy server.
Feb 13 10:44:18 examplesrv.net systemd[1]: Reloading A high performance web server and a reverse proxy server.
Feb 13 10:44:18 examplesrv.net systemd[1]: Reloaded A high performance web server and a reverse proxy server.

Chris8087
 
Posts: 17
Joined: 2014-11-13 10:35

Re: Since today: bash: nginx: command not found

Postby Chrisdb » 2020-02-13 10:03

what about
Code: Select all
echo $PATH
which nginx
Chrisdb
 
Posts: 226
Joined: 2018-04-10 07:16

Re: Since today: bash: nginx: command not found

Postby Chris8087 » 2020-02-13 11:17

Code: Select all
echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

which nginx
root@server:/#

# find -name nginx
./var/lib/nginx
./var/log/nginx
./etc/ufw/applications.d/nginx
./etc/logrotate.d/nginx
./etc/nginx
./etc/init.d/nginx
./etc/default/nginx
./usr/share/nginx
./usr/share/doc/nginx
./usr/lib/nginx
./usr/sbin/nginx


So it seems that /usr/sbin has been removed from the path? How (new VPS, just installed LEMP and created two vhosts/server blocks)?
Would have been my first time that this happens.
Chris8087
 
Posts: 17
Joined: 2014-11-13 10:35

Re: Since today: bash: nginx: command not found

Postby sunrat » 2020-02-13 12:58

“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!
User avatar
sunrat
 
Posts: 2956
Joined: 2006-08-29 09:12
Location: Melbourne, Australia

Re: Since today: bash: nginx: command not found

Postby Chris8087 » 2020-02-14 02:09

sunrat wrote:Read this - viewtopic.php?f=16&t=142973


Perfect, thanks.
Chris8087
 
Posts: 17
Joined: 2014-11-13 10:35


Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 12 guests

fashionable