"server" directive is not allowed here error

Reinis Rozitis r at roze.lv
Sat Jun 3 18:21:46 UTC 2017

> [emerg] 19968#0: "server" directive is not allowed here in /usr/local/nginx/conf/sites-enabled/server.domain.tld-ssl:1
> Googling the error, kept bring up results about the server directive being inside an http directive, which I don’t obviously have or have a need for. I would appreciate some help on this.

You can't have server {} block outside http {} ( http://nginx.org/en/docs/http/ngx_http_core_module.html#server )

So it has to be:

http {
  server {
   // whatever goes here


More information about the nginx mailing list