Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"daemon" directive is duplicate in /etc/nginx/nginx.conf error #2366

Closed
hamiltlr opened this issue Jan 1, 2024 · 3 comments
Closed

"daemon" directive is duplicate in /etc/nginx/nginx.conf error #2366

hamiltlr opened this issue Jan 1, 2024 · 3 comments

Comments

@hamiltlr
Copy link

hamiltlr commented Jan 1, 2024

I'm using the latest image. After pulling the newest image, my container failed to start with this error:

forego      | starting nginx.1 on port 19500

nginx.1     | nginx: [emerg] "daemon" directive is duplicate in /etc/nginx/nginx.conf:33

Doing some digging, I found PR #2359 which seems to be related.

I have my nginx.conf mapped as a local file, and I see that it has

daemon off;

at the end. Commenting that out resolves the error and the container starts successfully. Leaving it there and going back to the 1.4 tag also does not have the issue.

I'm not sure if this is due to me having a nginx.conf mapped to a file (presumably making it static?) or if this is a bug, but figured I should open an issue. I ultimately plan to back off to the 1.4 tag for stability-sake.

@buchdag
Copy link
Member

buchdag commented Jan 1, 2024

Hi

I'm not sure if this is due to me having a nginx.conf mapped to a file

Yes, it is, this image work on the assumption that you use the internally provided nginx.conf (inherited from the nginx official image).

If you need to provide your own nginx.conf, I'd highly recommend to build your own image from nginxproxy/nginx-proxy and programmatically change the nginx.conf file inside your Dockerfile, like we do ourselves.

Providing a static version of nginx.conf puts you at risk of breakage if nginx update the base file they provide, or we change something ourselves like in #2359 (which was mirroring what nginx does on their own Dockerfiles, invoking nginx with -g daemong off; rather than putting it in the nginx.conf file like we did previously).

What changes are you making to nginx.conf ? 🤔

@buchdag
Copy link
Member

buchdag commented Jan 1, 2024

Also the correct quick solution in this case is to remove daemon off; from your nginx.conf file.

@hamiltlr
Copy link
Author

hamiltlr commented Jan 1, 2024

Thanks for the quick response! I compared my nginx.conf with the version from the stock container image, and the changes were pretty minor. I realized I can just add them under /etc/nginx/conf.d and they'll get included, so I was able to go back to the stock version and the latest tag works for me now. Thanks for the help!

@hamiltlr hamiltlr closed this as completed Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants