From 326a072ad0025a729806c9c9ab1d98effc65886a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 29 Aug 2014 09:09:09 +0100 Subject: [PATCH] Use mod_proxy_fcgi for FCGI support with apache 2.4 --- cookbooks/web/recipes/backend.rb | 8 +++++++- cookbooks/web/templates/default/apache.backend.erb | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cookbooks/web/recipes/backend.rb b/cookbooks/web/recipes/backend.rb index b059d4f44..7dc229eeb 100644 --- a/cookbooks/web/recipes/backend.rb +++ b/cookbooks/web/recipes/backend.rb @@ -24,10 +24,16 @@ include_recipe "web::cgimap" web_passwords = data_bag_item("web", "passwords") -apache_module "fastcgi-handler" apache_module "remoteip" apache_module "rewrite" +if node[:lsb][:release].to_f >= 14.04 + apache_module "proxy" + apache_module "proxy_fcgi" +else + apache_module "fastcgi-handler" +end + apache_site "default" do action [ :disable ] end diff --git a/cookbooks/web/templates/default/apache.backend.erb b/cookbooks/web/templates/default/apache.backend.erb index 7f3c3977b..336ab56c5 100644 --- a/cookbooks/web/templates/default/apache.backend.erb +++ b/cookbooks/web/templates/default/apache.backend.erb @@ -49,8 +49,14 @@ # RewriteRule ^/api/0\.6/map$ - [H=fcgi:127.0.0.1:8000] RewriteCond %{REQUEST_METHOD} ^(HEAD|GET)$ +<% if node[:lsb][:release].to_f >= 14.04 -%> + RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full$ fcgi://127.0.0.1:8000$0 [P] + RewriteRule ^/api/0\.6/(nodes|ways|relations)$ fcgi://127.0.0.1:8000$0 [P] +<% else -%> RewriteRule ^/api/0\.6/(node|way|relation)/[0-9]+$ - [H=fcgi:127.0.0.1:8000] RewriteRule ^/api/0\.6/(way|relation)/[0-9]+/full$ - [H=fcgi:127.0.0.1:8000] RewriteRule ^/api/0\.6/(nodes|ways|relations)$ - [H=fcgi:127.0.0.1:8000] +<% end -%> <% end -%> -- 2.39.5