Start NGINX in Ubuntu

Ik gebruik dit SH-bestand om NGINX te installeren. Maar wanneer ik de nginx.conf gewijzigd en geprobeerd is om te herladen of opnieuw te starten NGINX, startte het niet opnieuw op.
deze opdracht

sudo systemctl restart nginx

gaf me

sudo: unable to resolve host localhost.localdomain sudo: systemctl: command not found

en deze

sudo service nginx restart
sudo: unable to resolve host localhost.localdomain nginx: unrecognized service

en deze

sudo /etc/init.d/nginx restart
sudo: unable to resolve host localhost.localdomain sudo:
/etc/init.d/nginx: command not found

Antwoord 1, Autoriteit 100%

Bestand is er waarschijnlijk: / usr / local / nginx / sbin / nginx
Om zeker te zijn dat u kunt doen:

ps aux | grep nginx

Om het proces te doden:

sudo killall nginx

en begin opnieuw:

/usr/local/nginx/sbin/nginx

Antwoord 2, Autoriteit 405%

De NGINX-webserver kan opnieuw worden opgestart met een van de volgende opdrachtregelsyntaxis. Gebruik systemctlop SYSTEMD-gebaseerde versie zoals Ubuntu Linux 16.04LTS en hoger:

sudo systemctl restart nginx

of

sudo service nginx restart

of (oudere Ubuntu Linux-versie):

sudo /etc/init.d/nginx restart

Dezelfde opdrachten kunnen worden gebruikt voor start/ stop/ restartDE NGINX SERVER OP A RODE HAT 7 versies:

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx

of

sudo service nginx start
sudo service nginx stop
sudo service nginx restart

of

sudo /etc/init.d/nginx start
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx restart

Gebruik een van de volgende opdracht:

om de status van uw NGINX-server te bekijken

sudo service nginx status

of

sudo /etc/init.d/nginx status

of voor rode hoed 7, CentoS 7 en hoger

sudo systemctl status nginx

Other episodes