# Ubuntu
sudo apt install nginx-light  # 精简版
# CentOS
sudo yum install nginx

#启动并设置开机自启
sudo systemctl daemon-reload
sudo systemctl start nginx
sudo systemctl enable nginx
#验证安装
nginx -v
curl -I 127.0.0.1
#常用命令:
# 重新加载配置
sudo systemctl reload nginx
# 检查配置语法
sudo nginx -t
# 查看运行状态
sudo systemctl status nginx

配置文件位置

  • 主配置:/etc/nginx/nginx.conf

  • 站点配置:/etc/nginx/conf.d/

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐