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

[Support] Can't set directives out of the http context #247

Closed
Frondor opened this issue May 15, 2018 · 1 comment
Closed

[Support] Can't set directives out of the http context #247

Frondor opened this issue May 15, 2018 · 1 comment

Comments

@Frondor
Copy link

Frondor commented May 15, 2018

This is not an issue for sure, but I'm a newbie and found some problems when trying to use this image.

Basically, I want to use the nginx-app.template approach based on what's written in the docs:

  nginx:
    container_name: webserver
    build:
      context: ./
      dockerfile: ./nginx/Dockerfile
    depends_on:
      - restful_api
    ports:
      - "80:80"
      - "443:443"
    environment:
      - NGINX_PORT=80
    volumes:
      - ./nginx/nginx-app.template:/etc/nginx/conf.d/nginx-app.template
      - ./nginx/certs:/etc/ssl/certs
    command: /bin/sh -c "envsubst '$$NGINX_PORT' < /etc/nginx/conf.d/nginx-app.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
    restart: unless-stopped

but if I want to set something like worker_processes or such directives, it's not possible because it seems to be included inside the http context of /etc/nginx.conf (or something like that).

This is not possible for instance

worker_processes auto;
worker_rlimit_nofile 2048; 
worker_connections 1024;

events {}

http { ... }

Is there a way I can provide such configuration and still use the envsubst approach?
Wouldn't be a good idea to include another .conf file at the global context?
i.e:

# nginx.conf
include       /etc/nginx/default.conf;
http {
    include /etc/nginx/conf.d/*.conf;
}
@thresheek
Copy link
Collaborator

You can include any nginx.conf you'd like and run multiple envsubst commands in your line.

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

3 participants
@thresheek @Frondor and others