Public instance methods
apache_server
()
Installs Apache 2.2 and enables mod_rewrite and mod_status. Enables mod_ssl if configuration[:ssl] is present
[show source]
# File lib/moonshine/manifest/rails/apache.rb, line 5 5: def apache_server 6: package "apache2-mpm-worker", :ensure => :installed 7: service "apache2", :require => package("apache2-mpm-worker"), :restart => '/etc/init.d/apache2 restart', :ensure => :running 8: a2enmod('rewrite') 9: a2enmod('status') 10: if configuration[:ssl] 11: a2enmod('headers') 12: a2enmod('ssl') 13: end 14: if configuration[:apache] && configuration[:apache][:users] 15: htpasswd = configuration[:apache][:htpasswd] || "#{configuration[:deploy_to]}/shared/config/htpasswd" 16: 17: file htpasswd, :ensure => :file, :owner => 'rails', :mode => '644' 18: 19: configuration[:apache][:users].each do |user,pass| 20: exec "htpasswd #{user}", 21: :command => "htpasswd -b #{htpasswd} #{user} #{pass}", 22: :unless => "grep '#{user}' #{htpasswd}" 23: end 24: end 25: status = "<IfModule mod_status.c>\nExtendedStatus On\n<Location /server-status>\nSetHandler server-status\norder deny,allow\ndeny from all\nallow from 127.0.0.1\n</Location>\n</IfModule>\n" 26: file '/etc/apache2/mods-available/status.conf', 27: :ensure => :present, 28: :mode => '644', 29: :require => exec('a2enmod status'), 30: :content => status, 31: :notify => service("apache2") 32: file '/etc/logrotate.d/varlogapachelog.conf', :ensure => :absent 33: end