Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created July 24, 2015 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbhishekGhosh/c3caea9f78b977295b08 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/c3caea9f78b977295b08 to your computer and use it in GitHub Desktop.
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