feat: add cache to simpleproxy

This commit is contained in:
Ben Vincent 2024-07-06 17:59:38 +10:00
parent 354e561380
commit d1dd12a091

View File

@ -99,15 +99,39 @@ class profiles::nginx::simpleproxy (
# merge the hashes conditionally
$nginx_parameters = merge($defaults, $extras_hash)
## manage cache for nginx
#file {'/var/cache/nginx/cache':
# ensure => 'directory',
# owner => 'nginx',
# group => 'root',
# mode => '0700',
#}
#file {'/var/cache/nginx/cache_temp':
# ensure => 'directory',
# owner => 'nginx',
# group => 'root',
# mode => '0700',
#}
# manage the nginx class
include 'nginx'
class { 'nginx':
proxy_cache_path => {
'/var/cache/nginx/cache' => 'cache:128m',
},
proxy_cache_levels => '1:2',
proxy_cache_keys_zone => 'cache:128m',
proxy_cache_max_size => '1024m',
proxy_cache_inactive => '10m',
proxy_temp_path => '/var/cache/nginx/cache_temp',
}
# create the nginx vhost with the merged parameters
create_resources('nginx::resource::server', { $nginx_vhost => $nginx_parameters })
# create nginx locations
if $use_default_location == false {
create_resources('nginx::resource::location', $locations)
create_resources('nginx::resource::location', $locations => {'server' => $nginx_vhost})
}
# manage selinux