I use this sh file to install Nginx. but when I modify the nginx.conf and tried to reload or restart Nginx it didn't restart. this command
sudo systemctl restart nginx
gave me
sudo: unable to resolve host localhost.localdomain sudo: systemctl: command not found
and this one
sudo service nginx restart
sudo: unable to resolve host localhost.localdomain nginx: unrecognized service
and this one
sudo /etc/init.d/nginx restart
sudo: unable to resolve host localhost.localdomain sudo:
/etc/init.d/nginx: command not found
The nginx web server can be restarted using any one of the following command line syntax. Use systemctl
on systemd based version such as Ubuntu Linux 16.04LTS and above:
sudo systemctl restart nginx
OR
sudo service nginx restart
OR (older Ubuntu Linux version):
sudo /etc/init.d/nginx restart
The same commands can be used to start
/ stop
/ restart
the nginx server on a Red Hat 7 versions:
sudo systemctl start nginx sudo systemctl stop nginx sudo systemctl restart nginx
OR
sudo service nginx start sudo service nginx stop sudo service nginx restart
OR
sudo /etc/init.d/nginx start sudo /etc/init.d/nginx stop sudo /etc/init.d/nginx restart
To view status of your nginx server, use any one of the following command:
sudo service nginx status
OR
sudo /etc/init.d/nginx status
OR for Red Hat 7, CentOS 7 and higher
sudo systemctl status nginx
File probably is there: /usr/local/nginx/sbin/nginx to be sure You can do:
ps aux | grep nginx
To kill process:
sudo killall nginx
And start again:
/usr/local/nginx/sbin/nginx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With