- 在SDS操作系统中,可使用systemctl工具来管理服务,如启动、停止、重启、重载服务及查看状态。
- 使用包管理工具安装nginx,一个web服务器,命令为
sudo dnf install nginx -y。 - 安装后,用
systemctl start命令启动nginx。 - 查看nginx的状态用
systemctl status nginx,运行中状态表示为active (running)。 - 停止服务使用
systemctl stop nginx,再次查看状态会显示inactive (dead)。 - 修改nginx配置文件,在
/etc/nginx/nginx.conf中更改user指令后,保存退出。 - 为使配置生效,需使用
systemctl reload nginx重载服务。 - 确认nginx工作进程(worker process)现在运行在新用户下。
- 如需移除nginx,使用命令
sudo dnf remove nginx -y。