mod_php_apache2.rb 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #
  2. # Cookbook Name:: application
  3. # Recipe:: mod_php_apache2
  4. #
  5. # Copyright 2011, Opscode, Inc.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. Chef::Log.warn "The application::mod_php_apache2 recipe is deprecated and will go away on Aug 1st. See the README for migration information."
  20. app = node.run_state[:current_app]
  21. node.default['apache']['listen_ports'] = [ "8080" ]
  22. include_recipe "apache2"
  23. include_recipe "apache2::mod_rewrite"
  24. include_recipe "apache2::mod_deflate"
  25. include_recipe "apache2::mod_headers"
  26. include_recipe "apache2::mod_php5"
  27. server_aliases = [ "#{app['id']}.#{node['domain']}", node['fqdn'] ]
  28. if node.has_key?("cloud")
  29. server_aliases << node['cloud']['public_hostname']
  30. end
  31. web_app app['id'] do
  32. docroot "#{app['deploy_to']}/current"
  33. template 'php.conf.erb'
  34. server_name "#{app['id']}.#{node['domain']}"
  35. server_aliases server_aliases
  36. log_dir node['apache']['log_dir']
  37. end
  38. if ::File.exists?(::File.join(app['deploy_to'], "current"))
  39. d = resources(:deploy_revision => app['id'])
  40. d.restart_command do
  41. service "apache2" do action :restart; end
  42. end
  43. end
  44. apache_site "000-default" do
  45. enable false
  46. end