安装
sudo apt-get update
sudo apt-get install nginx
测试nginx
sudo nginx -t
常用命令
#启动
sudo systemctl start nginx
#停止nginx
sudo systemctl stop nginx
#重启
sudo systemctl restart nginx
#进行配置更改后重新加载 Nginx 服务:
sudo systemctl reload nginx
#禁用自启动
sudo systemctl disable nginx
#启用自启动
sudo systemctl enable nginx
卸载nginx
#移除nginx
sudo apt-get --purge remove nginx
#移除全部不用试的软件包
sudo apt-get autoremove
#罗列出与nginx相关的软件并删除
dpkg --get-selections|grep nginx
#查看nginx正在运行的进程,如果有就kill掉
ps -ef |grep nginx
sudo kill -9 XXX