From fec6863727052589874a8727fb0cfd2f9cd2ef50 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 1 Jun 2016 23:57:18 +0100 Subject: [PATCH] imagery: add default site for socket settings --- cookbooks/imagery/recipes/default.rb | 3 ++- cookbooks/imagery/templates/default/nginx_default.conf.erb | 6 ++++++ cookbooks/imagery/templates/default/nginx_imagery.conf.erb | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 cookbooks/imagery/templates/default/nginx_default.conf.erb diff --git a/cookbooks/imagery/recipes/default.rb b/cookbooks/imagery/recipes/default.rb index d7827173b..946a4fdee 100644 --- a/cookbooks/imagery/recipes/default.rb +++ b/cookbooks/imagery/recipes/default.rb @@ -74,7 +74,8 @@ execute "unzip-ostn02-ntv2-data" do end nginx_site "default" do - action [:delete] + template "nginx_default.conf.erb" + directory "/srv/imagery/default" restart_nginx false end diff --git a/cookbooks/imagery/templates/default/nginx_default.conf.erb b/cookbooks/imagery/templates/default/nginx_default.conf.erb new file mode 100644 index 000000000..d3b8584a3 --- /dev/null +++ b/cookbooks/imagery/templates/default/nginx_default.conf.erb @@ -0,0 +1,6 @@ +server { + listen 80 fastopen=1024 default_server; + server_name _; + return 404 'default imagery server vhost. Please use correct URL.'; + add_header Content-Type text/plain; +} diff --git a/cookbooks/imagery/templates/default/nginx_imagery.conf.erb b/cookbooks/imagery/templates/default/nginx_imagery.conf.erb index b24989185..b36940973 100644 --- a/cookbooks/imagery/templates/default/nginx_imagery.conf.erb +++ b/cookbooks/imagery/templates/default/nginx_imagery.conf.erb @@ -1,5 +1,5 @@ server { - listen 80 fastopen=1024; + listen 80; server_name <%= @name %> a.<%= @name %> b.<%= @name %> c.<%= @name %><% @aliases.each do |alias_name| %> <%= alias_name %> a.<%= alias_name %> b.<%= alias_name %> c.<%= alias_name %><%- end -%>; root "/srv/<%= @name %>"; -- 2.39.5