"server" directive is not allowed here error

Jim Ohlstein jim at mailman-hosting.com
Sun Jun 4 10:36:25 UTC 2017


On Sun, 2017-06-04 at 10:28 +0000, Dino Edwards wrote:
> > 
> > You can't have server {} block outside http {} ( http://nginx.org/e
> > n/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

The "http" directive is likely in your main nginx.conf.

For testing (not maintenance), you may try putting it all in one file
so you can more easily find your error. Likely, as has been suggested,
it is a misplaced curly brace ({ or }).

> 
> Thanks in advance
> 
Jim Ohlstein
Professional Mailman Hosting
https://mailman-hosting.com/



More information about the nginx mailing list