A
A
Andronas2017-05-22 12:53:57
linux
Andronas, 2017-05-22 12:53:57

Nginx won't start, but config check doesn't show any errors?

Nginx 1.12.0, Linux RH 7.2
Installed, made a config - checking the config shows that everything is OK:
nginx: the configuration file /etc/nginx/conf.d/ev1.conf syntax is ok
nginx: configuration file /etc/nginx/conf .d/ev1.conf

test is
successful
See "systemctl status nginx.service" and "journalctl -xe" for details.
looking at logs:
Starting nginx - high performance web server...
nginx: [emerg] "events" directive is not allowed here in /etc/nginx/conf.d/ev1.conf:1
nginx: configuration file /etc/nginx/ nginx.conf test failed
nginx.service: control process exited, code=exited status=1
I start it with the standard config - it starts without errors. I return a config - again errors. How to understand what is wrong with the config (the config test is fine).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Mikhalev, 2017-05-22
@Andronas

"events" directive is not allowed here in /etc/nginx/conf.d/ev1.conf:1

here he says.
checking nginx is done with the command:
nginx -t

P
pfg21, 2017-05-22
@pfg21

check on behalf of the user under which nginx starts in systemd
, for example
sudo -u %user% nginx -t

A
Andronas, 2017-05-22
@Andronas

Thanks everyone, the problem turned out to be that in the main config in /etc/nginx/nginx.conf there were sections that were duplicated in the config /etc/nginx/conf.d/ev1.conf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question