Permalink
Browse files

FIXES: web_app includes apache2::default, and nginx_site doesn't have…

… a template
  • Loading branch information...
1 parent bd2e3e1 commit 8434de766145c26c63b9905d2fa2b466775b73d4 @ivey ivey committed Apr 20, 2012
Showing with 27 additions and 23 deletions.
  1. +24 −20 recipes/default.rb
  2. +3 −3 templates/default/sites.conf.erb
View
@@ -91,27 +91,31 @@
include_recipe "drupal::cron"
-# Apache
-web_app node[:drupal][:site][:name] do
- only_if { node[:drupal][:webserver] == "apache2" }
- template "drupal.conf.erb"
- docroot "#{node[:drupal][:dir]}"
- server_name server_fqdn
- server_aliases node.fqdn
-end
+if node[:drupal][:webserver] == "apache2"
+ web_app node[:drupal][:site][:name] do
+ template "drupal.conf.erb"
+ docroot "#{node[:drupal][:dir]}"
+ server_name server_fqdn
+ server_aliases node.fqdn
+ end
-execute "disable-default-site" do
- only_if { node[:drupal][:webserver] == "apache2" }
- command "sudo a2dissite default"
- notifies :reload, resources(:service => "apache2"), :delayed
+ execute "disable-default-site" do
+ command "sudo a2dissite default"
+ notifies :reload, resources(:service => "apache2"), :delayed
+ end
end
-
-# nginx
-nginx_site node[:drupal][:site][:name] do
- only_if { node[:drupal][:webserver] == "nginx" }
- template "sites.conf.erb"
- server_name server_fqdn
- server_aliases [node.fqdn]
- docroot "#{node[:drupal][:dir]}"
+if node[:drupal][:webserver] == "nginx"
+ template "#{node[:nginx][:dir]}/sites-enabled/#{node[:drupal][:site][:name]}" do
+ source "sites.conf.erb"
+ owner "root"
+ group "root"
+ mode "0600"
+ variables(
+ :docroot => "#{node[:drupal][:dir]}",
+ :server_name => server_fqdn
+ )
+ end
+
+ nginx_site node[:drupal][:site][:name]
end
@@ -1,10 +1,10 @@
server {
listen 80;
- server_name <%= @params[:server_name] %>;
+ server_name <%= @server_name %>;
- access_log <%= node[:nginx][:log_dir] %>/<%= @params[:server_name] %>.access.log;
+ access_log <%= node[:nginx][:log_dir] %>/<%= @server_name %>.access.log;
- root <%= @params[:docroot] %>;
+ root <%= @docroot %>;
index index.php;
if (!-e $request_filename) {

0 comments on commit 8434de7

Please sign in to comment.