环境: linux docker

  • 安装:
sudo apt update 
sudo apt install nginx
  • 运行:

由于我所在的Docker容器不支持systemd,所以直接运行 nginx 命令启动服务:

sudo nginx
  • 其它命令:
    测试配置 :nginx -t
    重新加载配置: sudo nginx -s reload
    优雅停止 Nginx : nginx -s quit

  • 配置:
    安装后的配置文件是/etc/nginx/nginx.conf,其中有一句include /etc/nginx/conf.d/*.conf; 表示 Nginx 会加载 /etc/nginx/conf.d/ 目录下所有以 .conf 结尾的配置文件。

更多推荐