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