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

Setting up nginx cache, not getting the expected result. #424

Closed
gl00ten opened this issue Aug 25, 2014 · 7 comments
Closed

Setting up nginx cache, not getting the expected result. #424

gl00ten opened this issue Aug 25, 2014 · 7 comments
Labels
needs-feedback Further information is requested

Comments

@gl00ten
Copy link

gl00ten commented Aug 25, 2014

I have this code:

# class: test::nginx
class test::nginx {
  # create directories here if needed
  # $dirs = ['/dir1', '/dir1/dir2, '/dir3',]
  #
  #  file { $dirs:
  #    ensure => directory,
  #    mode   => '0755',
  #  }

  class { '::nginx':
    proxy_cache_path => '/data/nginx/cache keys_zone=one:10m',
  }

  # maybe this resource is not necessary
  nginx::resource::vhost { 'test2.local':
    ensure   => present,
    www_root => '/var/www',
  }

  nginx::resource::location { 'cached':
    ensure      => present,
    www_root    => 'var/www',
    vhost       => 'test2.local',
    location    => '/cached',
    # 'one' comes from proxy path, most likely
    proxy_cache => 'one',
  }
}

But in the generated sites-enabled/test2.local.conf there is no:

    server {
        proxy_cache one;

as decribed here : http://nginx.com/resources/admin-guide/caching/

Am I missing something?

@pessoa
Copy link
Contributor

pessoa commented Aug 27, 2014

I'm trying to use this also on PE 3.3.0 (3.6.2). It seems that part of the config is not created. Anyone else able to confirm it?

@gl00ten
Copy link
Author

gl00ten commented Aug 29, 2014

The problem remains, but there was something experimental I forgot to remove in the code on my issue. Please look at it now.

@3flex
Copy link
Contributor

3flex commented Sep 3, 2014

The proxy parameter has to be set for the location resource to use the proxy template. The proxy value will get passed to the proxy_pass nginx directive.

Also note that you can't set proxy and www_root at the same time so be aware of that when you update your code.

@gl00ten
Copy link
Author

gl00ten commented Sep 4, 2014

Ty 3flex. Will I have to do anything about www_root in the vhost resource?

@3flex
Copy link
Contributor

3flex commented Sep 4, 2014

No, should work as is.

@3flex
Copy link
Contributor

3flex commented Apr 10, 2015

@fullmooninu did this answer your question? Please consider closing this issue if so. Thanks!

@3flex 3flex added the needs-feedback Further information is requested label Apr 13, 2015
@gl00ten
Copy link
Author

gl00ten commented Apr 17, 2015

Think so. Closing it. Thank you =)

@gl00ten gl00ten closed this as completed Apr 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-feedback Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants