apache_module "env"
apache_module "expires"
-apache_module "fastcgi-handler"
+apache_module "proxy"
+apache_module "proxy_fcgi"
apache_module "rewrite"
apache_module "wsgi"
end
service "php5-fpm" do
+ provider Chef::Provider::Service::Upstart
action [ :enable, :start ]
supports :status => true, :restart => true, :reload => true
end
mode 0644
end
-link "/etc/apache2/conf.d/phppgadmin" do
+file "/etc/apache2/conf.d/phppgadmin" do
action :delete
end
search(:accounts, "*:*").each do |account|
name = account["id"]
details = node[:accounts][:users][name] || {}
+ port = 7000 + account["uid"].to_i
if ["user","administrator"].include?(details[:status])
user_home = details[:home] || account["home"] || "#{node[:accounts][:home]}/#{name.to_s}"
owner "root"
group "root"
mode 0644
- variables :user => name
+ variables :user => name, :port => port
notifies :reload, "service[php5-fpm]"
end
apache_site "#{name}.dev.openstreetmap.org" do
template "apache.user.erb"
directory "#{user_home}/public_html"
- variables :user => name
+ variables :user => name, :port => port
end
end
end
CustomLog /var/log/apache2/apis.dev.openstreetmap.org-access.log combined
ErrorLog /var/log/apache2/apis.dev.openstreetmap.org-error.log
</VirtualHost>
+
+<Directory /srv/apis.dev.openstreetmap.org>
+ Require all granted
+</Directory>
# DO NOT EDIT - This file is being maintained by Chef
<VirtualHost *:80>
- ServerName <%= @name %>
+ ServerName <%= @name %>
<% @aliases.each do |alias_name| -%>
- ServerAlias <%= alias_name %>
+ ServerAlias <%= alias_name %>
<% end -%>
- ServerAdmin webmaster@openstreetmap.org
+ ServerAdmin webmaster@openstreetmap.org
- DocumentRoot /srv/<%= @name %>/public
+ DocumentRoot /srv/<%= @name %>/public
- CustomLog /var/log/apache2/<%= @name %>-access.log combined
- ErrorLog /var/log/apache2/<%= @name %>-error.log
+ CustomLog /var/log/apache2/<%= @name %>-access.log combined
+ ErrorLog /var/log/apache2/<%= @name %>-error.log
- RailsEnv production
+ RailsEnv production
- SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
+ SetEnv SECRET_KEY_BASE <%= @secret_key_base %>
</VirtualHost>
+
+<Directory /srv/<%= @name %>/public>
+ Require all granted
+</Directory>
+
+<Directory /srv/<%= @name %>/app/assets>
+ Require all granted
+</Directory>
+
+<Directory /srv/<%= @name %>/vendor/assets>
+ Require all granted
+</Directory>
RewriteCond <%= @directory %>%{REQUEST_FILENAME} -f
RewriteRule ^/cgi-bin-d/(.*)$ /cgi-bin/cgiwrapd/~<%= @user %>/cgi-bin/$1 [PT,L]
- <IfModule mod_fastcgi_handler.c>
- <FilesMatch "\.ph(p3?|tml)$">
- SetHandler fcgi:/var/run/php5-fpm-<%= @user %>.sock
- </FilesMatch>
- <FilesMatch "\.phps$">
- SetHandler fcgi:/var/run/php5-fpm-<%= @user %>.sock
- </FilesMatch>
- </IfModule>
-
- <IfModule !mod_fastcgi_handler.c>
- RewriteCond <%= @directory %>%{REQUEST_FILENAME} -f
- RewriteRule ^(.*\.php)$ /cgi-bin/php-cgiwrap/~<%= @user %>/$1 [PT,L]
- </IfModule>
+ ProxyPassMatch ^/(.*\.ph(p|ps|p3|tml)(/.*)?)$ fcgi://127.0.0.1:<%= @port %><%= @directory %>/$1
</VirtualHost>
<Directory <%= @directory %>>
AllowOverride AuthConfig FileInfo Indexes Options=RailsBaseURI
Options SymLinksIfOwnerMatch Indexes Includes
+ Require all granted
</Directory>
<Directory <%= @directory %>/wsgi-bin>
SetHandler wsgi-script
Options ExecCGI SymLinksIfOwnerMatch
+ Require all granted
</Directory>
; DO NOT EDIT - This file is being maintained by Chef
[<%= @user %>]
-listen = /var/run/php5-fpm-<%= @user %>.sock
-
+listen = 127.0.0.1:<%= @port %>
listen.backlog = 256
-
-listen.owner = www-data
-listen.group = www-data
-listen.mode = 0660
user = <%= @user %>
group = <%= @user %>