Linx操作Nginx命令
在 CentOS 上操作 Nginx 包括安装、启动、停止、重新加载配置等。以下是在 CentOS 上操作 Nginx 的常用命令:
-
安装 Nginx:
sudo yum install nginx -
启动 Nginx:
sudo systemctl start nginx -
停止 Nginx:
sudo systemctl stop nginx -
重新加载 Nginx 配置:
sudo systemctl reload nginx -
重启 Nginx:
sudo systemctl restart nginx -
查看 Nginx 状态:
sudo systemctl status nginx -
开机自启动 Nginx:
sudo systemctl enable nginx -
停止开机自启动 Nginx:
sudo systemctl disable nginx
以上命令中,使用了 systemctl 来管理 Nginx 服务。在执行任何涉及到配置文件的操作(如重新加载配置、重启)之前,确保已经保存了修改的配置文件。
注意:在执行上述命令时,可能需要管理员权限。如果提示需要管理员权限,请使用 sudo 命令来运行相应的命令。

浙公网安备 33010602011771号