nginx icon indicating copy to clipboard operation
nginx copied to clipboard

Help me understand how the nginx environment works

Open michael-niemand opened this issue 3 years ago • 1 comments

Hi there,

We got the requirement to start nginx using sudo -E nginx instead of just the default sudo nginx (= I dont provide a command at all).

I tried changing the docker command to sudo -E nginx , but it fails to come up entirely now. So I'm trying to understand how it all works. The container runs as wodby user, where all the environment variables reside. Now the nginx is started with a regular sudo (without "-E") and it works. But how? If all the env vars are registered in the shell the container runs as (=wodby), how does the nginx see all these env vars? Are they passed into the sudo environment somehow? Or maybe the nginx doesnt even need the env vars since it's config is being generated out of these? But then why won't it work with sudo -E since there should be a proper config file either way. I really hope someone can help me understand, thank you!!

michael-niemand avatar Mar 23 '21 13:03 michael-niemand

The configuration env variables are used when starting the container by gotpl to generate the nginx configuration, after that those are not used. If you manually start nginx (bypassing the default docker-entrypoint.sh) you need to make sure that the nginx configuration is already present.

esolitos avatar Jul 06 '21 07:07 esolitos