阅读量:4
在Ubuntu上管理Nginx服务,可使用以下命令:
- 启动服务:
sudo systemctl start nginx - 停止服务:
sudo systemctl stop nginx - 重启服务:
sudo systemctl restart nginx - 重新加载配置:
sudo systemctl reload nginx - 查看状态:
sudo systemctl status nginx - 设置开机自启:
sudo systemctl enable nginx - 禁用开机自启:
sudo systemctl disable nginx
此外,还可通过编辑配置文件来管理Nginx,如修改/etc/nginx/nginx.conf主配置文件,或在/etc/nginx/sites-available/目录下创建站点配置文件,并通过sudo ln -s命令将其链接到/etc/nginx/sites-enabled/目录来启用。修改配置后,需用sudo nginx -t测试配置文件语法,无误后用sudo systemctl reload nginx重新加载配置。
以上就是关于“如何用Ubuntu管理Nginx服务”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm