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

Sorting keys breaks nginx.conf #122

Closed
devster31 opened this issue May 29, 2016 · 3 comments
Closed

Sorting keys breaks nginx.conf #122

devster31 opened this issue May 29, 2016 · 3 comments

Comments

@devster31
Copy link

devster31 commented May 29, 2016

Using a pillar like:

nginx:
  ng:
    server:
      config:
        http:
          log_format: "main '$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\"'" \"$http_user_agent\" \"$http_x_forwarded_for\""
          access_log: logs/access.log main

with the state nginx.ng.config produces an invalid nginx.conf since the access_log directive is put higher in the config and the log_format isn't defined yet.
Nginx HTTP Log Module Reference

@gravyboat
Copy link
Contributor

We've actually tried to work around issues like this before with some fancy jinja templating. I feel like the only way to really get around it is to redesign how part of the ng formula works.

@mstarostik
Copy link

mstarostik commented Jul 1, 2016

Ugly but practical workaround for the log_format case:

http:
  log_format: |-
    main '...';
        access_log /var/log/nginx/access_log main

EDIT: plus of course

  access_log: []

in order to suppress the default access_log option from being added.

On a side node: couldn't nginx.conf be generated with an orderd list in pillar like the managed vhosts are?

@noelmcloughlin
Copy link
Member

Thanks @mstarostik I raised #208 to document your work.

aboe76 added a commit that referenced this issue Jan 25, 2019
Document #122 solution in pillar.example
This was referenced Apr 11, 2019
blarghmatey pushed a commit to mitodl/nginx-formula that referenced this issue Dec 17, 2019
markbreedlove pushed a commit to mitodl/nginx-formula that referenced this issue Dec 17, 2019
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

4 participants