跳到主要内容

谈谈nginx常用配置

  • root
  • alias
  • proxy
  • try_files

常用命令​

  • -t:test,检查配置,输出配置目录
  • -T : test + print,检查并输出完整配置 (会输出配置的内容)
  • -s : 可以理解为signal(信号),给正在运行的nginx主进程发送控制信号
bash
# 查看nginx的配置目录
nginx -t

# 重新加载配置
nginx -s reload

# 查看 Nginx 状态
systemctl status nginx

# 启动
systemctl start nginx

# 停止
systemctl stop nginx

# 重启
systemctl restart nginx

# 重新加载配置,推荐
systemctl reload nginx