管理nginx

检查nginx的状态(查看nginx是否正在运行):

$systemctl status nginx

启动或者停止nginx:

$sudo systemctl start nginx
AND
$sudo systemctl stop nginx

在系统启动时自动启用或者禁用nginx:

$sudo systemctl enable nginx
$sudo systemctl disable nginx

重新加载或者重新启动nginx -- 重新加载将重新加载配置文件,而重新启动将完全重新启动服务:

$sudo systemctl reload nginx

$sudo systemctl restart nginx

检查nginx配置文件是否有错误

$sudo nginx -t
如何在Linux上安装nginx

在Debian,Ubuntu和Linux Mint上安装nginx

$sudo apt update
$sudo apt install nginx

在Fedora,CentOS和Red Hat上安装Nginx

$sudo dnf upgrade
$sudo dnf install nginx

在Arch Linux和Manjaro上安装nginx

$sudo pacman -Syu
$sudo pacman -S nginx
日期:2020-07-07 20:57:16 来源:oir作者:oir