-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
185 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# Encoding: utf-8 | ||
# | ||
# Cookbook Name:: phpstack | ||
# Recipe:: apache | ||
# | ||
# Copyright 2014, Rackspace Hosting | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
# repo dependencies for php-fpm | ||
if platform_family?('rhel') | ||
include_recipe 'yum' | ||
include_recipe 'yum-epel' | ||
include_recipe 'yum-ius' | ||
elsif platform_family?('debian') | ||
include_recipe 'apt' | ||
end | ||
|
||
# Modules depedencies (Magento/Php-fpm) | ||
node.default['apache']['default_modules'] = %w( | ||
status actions alias auth_basic | ||
authn_file authz_default | ||
authz_groupfile authz_host | ||
authz_user autoindex dir env mime | ||
negotiation setenvif ssl headers | ||
expires log_config logio | ||
) | ||
|
||
%w( | ||
apache2 | ||
apache2::mod_fastcgi | ||
php-fpm | ||
).each do |recipe| | ||
include_recipe recipe | ||
end | ||
|
||
|
||
# create self signed certificate (enable by default) | ||
if node['magentostack']['web']['ssl_autosigned'] | ||
openssl_x509 node['magentostack']['web']['ssl_cert'] do | ||
common_name node.name | ||
org 'Magento' | ||
org_unit 'Magento' | ||
country 'US' | ||
key_file node['magentostack']['web']['ssl_key'] | ||
end | ||
end | ||
|
||
# Fast-cgi configuration | ||
apache_conf "fastcgi" do | ||
enable true | ||
end | ||
|
||
# Create documentroot | ||
directory node['magentostack']['web']['dir'] do | ||
action :create | ||
not_if File.exists?(node['magentostack']['web']['dir']) | ||
end | ||
|
||
# Create vhost | ||
%w(default ssl).each do |site| | ||
web_app "#{site}" do | ||
template node['magentostack']['web']['template'] | ||
cookbook node['magentostack']['web']['cookbook'] | ||
http_port node['magentostack']['web']['http_port'] | ||
docroot node['magentostack']['web']['dir'] | ||
server_name node['magentostack']['web']['domain'] | ||
server_aliases node['magentostack']['web']['server_aliases'] | ||
ssl true if site == 'ssl' | ||
https_port node['magentostack']['web']['https_port'] | ||
ssl_cert node['magentostack']['web']['ssl_cert'] | ||
ssl_key node['magentostack']['web']['ssl_key'] | ||
end | ||
end | ||
|
||
|
||
|
||
# to add to include_recipe platformstack::monitors | ||
#template "http-monitor-#{site_opts['server_name']}-#{port}" do | ||
# cookbook stackname | ||
# source 'monitoring-remote-http.yaml.erb' | ||
# path "/etc/rackspace-monitoring-agent.conf.d/#{site_opts['server_name']}-#{port}-http-monitor.yaml" | ||
# owner 'root' | ||
# group 'root' | ||
# mode '0644' | ||
# variables( | ||
# http_port: port, | ||
# server_name: site_opts['server_name'] | ||
# ) | ||
# notifies 'restart', 'service[rackspace-monitoring-agent]', 'delayed' | ||
# action 'create' | ||
# only_if { node.deep_fetch('platformstack', 'cloud_monitoring', 'enabled') } | ||
#end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<IfModule mod_fastcgi.c> | ||
AddHandler php5-fcgi .php | ||
Action php5-fcgi /php5-fcgi | ||
Alias /php5-fcgi /usr/bin/php-cgi | ||
FastCgiExternalServer /usr/bin/php-cgi -socket /var/run/php-fpm-www.sock -flush -idle-timeout 1800 | ||
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<%- if @params[:ssl] %> | ||
<VirtualHost *:<%= @params[:https_port] %>> | ||
|
||
SSLEngine on | ||
SSLCertificateFile <%= @params[:ssl_cert] %> | ||
SSLCertificateKeyFile <%= @params[:ssl_key] %> | ||
<%- else %> | ||
<VirtualHost *:<%= @params[:http_port] %>> | ||
<%- end %> | ||
|
||
ServerName <%= @params[:server_name] %> | ||
<% if @params[:server_aliases] %>ServerAlias <%= @params[:server_aliases] %><% end %> | ||
DocumentRoot <%= @params[:docroot] %> | ||
DirectoryIndex index.php | ||
|
||
# Enable this line if you are terminating your SSL on a load-balancer. | ||
# SetEnvIf X-Forwarded-Proto https HTTPS=on | ||
|
||
<Directory <%= @params[:docroot] %>/> | ||
Options +FollowSymLinks | ||
AllowOverride All | ||
<%- if @params[:ssl] %>SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128<%- end %> | ||
<IfModule mod_deflate.c> | ||
SetOutputFilter DEFLATE | ||
BrowserMatch ^Mozilla/4 gzip-only-text/html | ||
BrowserMatch ^Mozilla/4\.0[678] no-gzip | ||
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html | ||
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary | ||
Header append Vary User-Agent env=!dont-vary | ||
</IfModule> | ||
<ifModule mod_expires.c> | ||
ExpiresActive On | ||
ExpiresDefault "access plus 1 month" | ||
</IfModule> | ||
</Directory> | ||
|
||
#Log settings | ||
CustomLog <%= node['apache']['log_dir'] %>/<%= @params[:server_name] %>-<% if @params[:ssl] %>ssl_<% end %>access_log combined | ||
ErrorLog <%= node['apache']['log_dir'] %>/<%= @params[:server_name] %>-<% if @params[:ssl] %>ssl_<% end %>error_log | ||
|
||
<Location /server-status> | ||
SetHandler server-status | ||
|
||
<% if node['apache']['version'] == '2.2' -%> | ||
Order Deny,Allow | ||
Deny from all | ||
Allow from 127.0.0.1 | ||
<% elsif node['apache']['version'] == '2.4' -%> | ||
Require host 127.0.0.1 | ||
<% end -%> | ||
</Location> | ||
</VirtualHost> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<IfModule mod_fastcgi.c> | ||
AddHandler php5-fcgi .php | ||
Action php5-fcgi /php5-fcgi | ||
Alias /php5-fcgi /usr/bin/php-cgi | ||
FastCgiExternalServer /usr/bin/php-cgi -socket /var/run/php-fpm-www.sock -flush -idle-timeout 1800 | ||
</IfModule> |
640e67a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recipes/apache-fpm.rb
Cookbook name correction needed:
Cookbook Name:: phpstack should be Cookbook Name:: magentostack