Created
July 24, 2015 10:28
-
-
Save AbhishekGhosh/c3caea9f78b977295b08 to your computer and use it in GitHub Desktop.
CFEngine Nginx Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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