在使用 `systemctl` 管理 Nginx 服务时,可以通过以下命令执行常见的操作:
1. **启动 Nginx**:
```bash
sudo systemctl start nginx
```
2. **停止 Nginx**:
```bash
sudo systemctl stop nginx
```
3. **重启 Nginx**:
```bash
sudo systemctl restart nginx
```
4. **平滑重启 Nginx**(重新加载配置而不中断现有连接):
```bash
sudo systemctl reload nginx
```
5. **查看 Nginx 服务状态**:
```bash
sudo systemctl status nginx
```
6. **设置 Nginx 在开机时自动启动**:
```bash
sudo systemctl enable nginx
```
7. **禁用 Nginx 开机自动启动**:
```bash
sudo systemctl disable nginx
```
这些命令允许你方便地管理 Nginx 服务。