安装

sudo apt update
sudo apt install nginx -y
nginx -v    # 查看是否已安装
sudo systemctl status nginx   # 查看是否在运行

浏览器访问:http://localhost/

常用管理命令

# 启动 Nginx
sudo systemctl start nginx

# 停止 Nginx
sudo systemctl stop nginx

# 重启 Nginx(修改配置后必用)
sudo systemctl restart nginx

# 重新加载配置(不中断服务,推荐)
sudo systemctl reload nginx

# 设置开机自启
sudo systemctl enable nginx

# 取消开机自启
sudo systemctl disable nginx

Nginx 核心文件路径

❤️ 转载文章请注明出处,谢谢!❤️