Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CFEngine Nginx Example
bundle agent nginx
{
vars:
"redirect_server_stanza" string =>
"server {
listen 80;
server_name example.thecustomizewindows.com;
rewrite ^(.*)$ http://thecustomizewindows.$(def.domain)$1 permanent;
}
";
packages:
"nginx" package_policy => "addupdate";
processes:
"nginx: master"
restart_class => "restart_nginx";
files:
"/etc/nginx/nginx.conf"
edit_line => change_nginx_http_conf,
classes => if_repaired("restart_nginx");
homer::
"/etc/nginx/sites-enabled/thecustomizewindows_redirect",
link_from => ln_s("/etc/nginx/sites-available/thecustomizewindows_redirect"),
classes => if_repaired("restart_nginx");
"/etc/nginx/sites-available/thecustomizewindows_redirect"
perms => m("0644"),
create => "true",
edit_defaults => empty,
edit_line => insert_lines("$(redirect_server_stanza)"),
classes => if_repaired("restart_nginx");
commands:
restart_nginx::
"/usr/sbin/service nginx restart";
}
bundle edit_line change_nginx_http_conf
{
replace_patterns:
".*# server_names_hash_bucket_size.*"
replace_with => value(" server_names_hash_bucket_size 64;");
insert_lines:
" client_max_body_size 55m;"
location => after("http {");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment