执行 nginx 重启服务时,提示失败如下:

$ sudo service nginx restart 
 * Restarting nginx nginx
   ...fail!
  • 1
  • 2
  • 3
  • 1
  • 2
  • 3

原因是你配置 nginx 的配置文件出了错误

查找错误,处理方法:

 $ sudo nginx -t
 nginx: [emerg] "location" directive is not allowed
 here in /etc/nginx/nginx.conf:11
 nginx: configuration file /etc/nginx/nginx.conf
 test failed
  • 1
  • 2
  • 3
  • 4
  • 5
  • 1
  • 2
  • 3
  • 4
  • 5

根据错误信息,修改对应生的配置文件即可。

相关文章:

  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2022-03-08
  • 2021-09-03
  • 2022-12-23
  • 2021-11-24
相关资源
相似解决方案