在Ubuntu中重新启动Nginx

问题描述:

我使用这个sh file来安装Nginx。但是当我修改nginx.conf并尝试重新加载或重新启动Nginx时,它并未重新启动。 此命令在Ubuntu中重新启动Nginx

sudo systemctl restart nginx 

给我

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

而这一次

sudo service nginx restart 

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

而这一次

sudo /etc/init.d/nginx restart 

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

文件大概有:在/ usr /本地/ nginx的/ sbin目录/ nginx的 ,以确保你可以这样做:

ps aux | grep nginx 

杀死进程:

sudo killall nginx 

,并重新开始:

/usr/local/nginx/sbin/nginx