nazar-pc/docker-webserver

I can't test nginx config like cmd nignx -t , lets may be fix it?

Closed this issue · 1 comments

How i can test nginx config like nignx -t or reload like nginx -s reload ?

When i try docker-compose exec nginx nginx -t
I see error

2018/02/01 23:52:36 [emerg] 10#10: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

Why you don't want create symlynk for nginx configs for correct nginx work ?
Like this: mkdir -p /etc/nginx && ln -s /data/nginx/config/* /etc/nginx/

Config file is located at /data/nginx/config/nginx.conf, so naturally instead of nginx -t you need to use nginx -t -c /data/nginx/config/nginx.conf -p /data/nginx/config/ just like it is used in entrypoint:

set -- -c /data/nginx/config/nginx.conf -p /data/nginx/config/ $@

Creating symlink is possible, but I'm not sure if that is really needed, since most of the time you shouldn't need to run any commands there manually