Ubuntu 16.04下nginx 开机无法自启

自从 Ubuntu 15.04 之后,就已经开始默认使用 systemd 了,你的配制方法是传统的 Upstart/Sysinitv,所以不起作用。应该使用 systemd 对应的 systemctl 命令。

  • 启动: systemctl start nginx
  • 查看状态:systemctl status nginx
  • 设置为系统默认启动: systemctl enable nginx.service

而且不知道你的 Nginx 是如何安装的,在 Ubuntu/Debian 中,如果是使用标准的 apt-get install nginx 的方式,这些都已经配置好了,默认情况下,就是开机自启动。