diff --git "a/51 \346\235\216\346\254\243/20240624\346\234\215\345\212\241\347\256\241\347\220\206.md" "b/51 \346\235\216\346\254\243/20240624\346\234\215\345\212\241\347\256\241\347\220\206.md" new file mode 100644 index 0000000000000000000000000000000000000000..55e7dcc45bcd1fa39d4d53d146df4ac4e1dd2db6 --- /dev/null +++ "b/51 \346\235\216\346\254\243/20240624\346\234\215\345\212\241\347\256\241\347\220\206.md" @@ -0,0 +1,49 @@ +### 服务管理 + +service nginx start + +system v 用 /etc/init.d/nginx start 实现 + +systemd 用 systemctl nginx start 实现 + +早期 linux /etc/init.d/ 服务名 service 服务名 操作命令 + +现今 linux systemctl 操作命令 服务名 + +#### 操作命令 + +start 启用 + +stop 停止 + +restart 重启 + +reload 重加配置 + +enable 开机自启用 + +dsable 禁用 + +#### 查看所有运行服务 + +systemctl list -until-files 详细 + +service -status-all 精简 + +### 作业 + +```bash +#安装apache +sudo apt install apache2 +#查看状态 +service --status-all +#停止nginx +sudo systemctl stop nginx.service +#开启apache +sudo systemctl start apache2 +#查看apache状态 +sudo systemctl status apache2 + +进入/etc/apache2,里面的ports.conf 和 000-default.conf可改端口,从而让nginx和apache共存 +``` +