nginx: [emerg] “server” directive is not allowed here in …

目录 文章
nginx: [emerg] “server” directive is not allowed here in …-下一朵云

在nginx.conf中配置增加sever配置或者添加虚拟主机配置文件后

出现报错:nginx: [emerg] “server” directive is not allowed here in …

原因为原因是Server{}http{}外面了,应该放在http{}里面:

http{
      sever{   

      }
}

如果是添加虚拟主机配置文件后报错,检查include vhost/*.conf;在nginx.conf中的位置是否在http{}

http{
  
    include vhost/*.conf;
}