nginxinc/nginx-wiki

error on nginx service start

KurayamiNoDaiTenshi opened this issue · 3 comments

Hi,
I just try to update my nginx package on a debian 10 for my remove server, and just after the update I got this error :
systemd[1]: Starting nginx - high performance web server...
nginx: [emerg] "location" directive is not allowed here in /etc/nginx/conf.d/cache.conf:1
nginx.service: Control process exited, code=exited, status=1/FAILURE
nginx.service: Failed with result 'exit-code'.
Failed to start nginx - high performance web server.

Hey @KurayamiNoDaiTenshi -- I'm terribly sorry to say this but this is not the right place to ask about an NGINX error. Only issues directly related to the Wiki should be created here.

That being said, it looks like the error you're getting is related to the configuration file you have in cache.conf (you have a location directive in a context where it's not allowed). Fixing that should fix any issues you might have when updating the package 😄

Hi @alessfg
Can you tell me where can I post my message to find help? because in my cache.conf file I only have this :
`location ~* .(jpg|jpeg|gif|css|png|js|woff|ttf|svg|eot)$ {
expires 30d;
access_log off;
}

location ~* .(eot|ttf|woff|svg)$ {
add_header Acccess-Control-Allow-Origin *;
}
`
and when I compare it with other server it's the exact same content and when i try to just comment everything in this file the service status told me that they're a misplace 'location ' in my php.conf file. I do the same comment everything in the file try to restart no error at the start but nothing work ...

Locations have to live inside server blocks. At any rate, I would suggest the NGINX Open Source mailing list (http://mailman.nginx.org/mailman/listinfo/nginx) or Stack Overflow if you want more help.