"server" directive is not allowed here error

Dino Edwards dino.edwards at mydirectmail.net
Sun Jun 4 10:28:44 UTC 2017


> 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
>  }
> }


That can't be right, because before I used the multiple location directives, I didn't have http and it worked fine. Regardless, I followed your advice and I got the following now:

nginx: [emerg] "http" directive is not allowed here in /usr/local/nginx/conf/sites-enabled/ server.domain.tld -ssl:1

Thanks in advance


More information about the nginx mailing list