Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support Apache 2.4 and the event MPM.

  • Loading branch information...
commit 1a7a15a9324ec3611bf72dc5779aa6b34b5ceaf7 1 parent 7b45e32
@FooBarWidget FooBarWidget authored
View
1  NEWS
@@ -1,6 +1,7 @@
Release 3.0.12
--------------
+ * [Apache] Support Apache 2.4. The event MPM is now also supported.
* [Nginx] Preferred Nginx version upgraded to 1.0.14.
* [Nginx] Preferred PCRE version upgraded to 8.30.
* [Nginx] Fixed compatibility with Nginx < 1.0.10.
View
4 bin/passenger-install-apache2-module
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
# Phusion Passenger - http://www.modrails.com/
-# Copyright (c) 2010 Phusion
+# Copyright (c) 2010, 2011, 2012 Phusion
#
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
#
@@ -124,7 +124,7 @@ private
mpm = nil
end
end
- if mpm != "prefork" && mpm != "worker"
+ if mpm != "prefork" && mpm != "worker" && mpm != "event"
new_screen
render_template 'apache2/apache_must_be_compiled_with_compatible_mpm',
:current_mpm => mpm
View
26 ext/apache2/Hooks.cpp
@@ -1,6 +1,6 @@
/*
* Phusion Passenger - http://www.modrails.com/
- * Copyright (c) 2010 Phusion
+ * Copyright (c) 2010, 2011, 2012 Phusion
*
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
*
@@ -79,6 +79,10 @@ using namespace Passenger;
extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
+#ifdef APLOG_USE_MODULE
+ APLOG_USE_MODULE(passenger);
+#endif
+
/**
* If the HTTP client sends POST data larger than this value (in bytes),
@@ -99,6 +103,11 @@ extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
#endif
#endif
+#if HTTP_VERSION(AP_SERVER_MAJORVERSION_NUMBER, AP_SERVER_MINORVERSION_NUMBER) >= 2004
+ // Apache >= 2.4
+ #define unixd_config ap_unixd_config
+#endif
+
/**
* Apache hook functions, wrapped in a class.
@@ -980,14 +989,23 @@ class Hooks {
// Set standard CGI variables.
- addHeader(headers, "SERVER_SOFTWARE", ap_get_server_version());
+ #ifdef AP_GET_SERVER_VERSION_DEPRECATED
+ addHeader(headers, "SERVER_SOFTWARE", ap_get_server_description());
+ #else
+ addHeader(headers, "SERVER_SOFTWARE", ap_get_server_version());
+ #endif
addHeader(headers, "SERVER_PROTOCOL", r->protocol);
addHeader(headers, "SERVER_NAME", ap_get_server_name(r));
addHeader(headers, "SERVER_ADMIN", r->server->server_admin);
addHeader(headers, "SERVER_ADDR", r->connection->local_ip);
addHeader(headers, "SERVER_PORT", apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
- addHeader(headers, "REMOTE_ADDR", r->connection->remote_ip);
- addHeader(headers, "REMOTE_PORT", apr_psprintf(r->pool, "%d", r->connection->remote_addr->port));
+ #if HTTP_VERSION(AP_SERVER_MAJORVERSION_NUMBER, AP_SERVER_MINORVERSION_NUMBER) >= 2004
+ addHeader(headers, "REMOTE_ADDR", r->connection->client_ip);
+ addHeader(headers, "REMOTE_PORT", apr_psprintf(r->pool, "%d", r->connection->client_addr->port));
+ #else
+ addHeader(headers, "REMOTE_ADDR", r->connection->remote_ip);
+ addHeader(headers, "REMOTE_PORT", apr_psprintf(r->pool, "%d", r->connection->remote_addr->port));
+ #endif
addHeader(headers, "REMOTE_USER", r->user);
addHeader(headers, "REQUEST_METHOD", r->method);
addHeader(headers, "QUERY_STRING", r->args ? r->args : "");
View
2  ext/apache2/mod_passenger.c
@@ -1,6 +1,6 @@
/*
* Phusion Passenger - http://www.modrails.com/
- * Copyright (c) 2010 Phusion
+ * Copyright (c) 2010, 2011, 2012 Phusion
*
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
*
View
13 lib/phusion_passenger/platform_info/apache.rb
@@ -1,5 +1,5 @@
# Phusion Passenger - http://www.modrails.com/
-# Copyright (c) 2010 Phusion
+# Copyright (c) 2010, 2011, 2012 Phusion
#
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
#
@@ -80,6 +80,17 @@ def self.httpd
end
end
memoize :httpd
+
+ # The Apache version, or nil if Apache is not found.
+ def self.httpd_version
+ if httpd
+ `#{httpd} -v` =~ %r{Apache/([\d\.]+)}
+ return $1
+ else
+ return nil
+ end
+ end
+ memoize :httpd_version
# The absolute path to the 'apr-config' or 'apr-1-config' executable,
# or nil if not found.
View
10 lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb
@@ -1,9 +1,9 @@
-<red>WARNING:</red> <yellow>Apache doesn't seem to be compiled with the 'prefork' or 'worker' MPM</yellow>
+<red>WARNING:</red> <yellow>Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM</yellow>
-Passenger has only been tested on Apache with the 'prefork' and the 'worker'
-MPM. Your Apache installation is compiled with the '<%= @current_mpm %>' MPM. We recommend
-you to abort this installer and to recompile Apache with either the 'prefork'
-or the 'worker' MPM.
+Phusion Passenger has only been tested on Apache with the 'prefork', the
+'worker' and the 'worker' MPM. Your Apache installation is compiled with

'worker' and the 'event' MPM

@FooBarWidget Owner

Doh. Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+the '<%= @current_mpm %>' MPM. We recommend you to abort this installer and to recompile
+Apache with either the 'prefork', the 'worker' or the 'event' MPM.
<b>Press Ctrl-C to abort this installer (recommended).</b>
<b>Press Enter if you want to continue with installation anyway.</b>
View
15 test/stub/apache2/httpd.conf.erb
@@ -29,6 +29,10 @@ Listen 127.0.0.1:<%= @port %>
<% if !has_builtin_module?('mod_env.c') %>
LoadModule env_module "<%= modules_dir %>/mod_env.so"
<% end %>
+<% if PlatformInfo.httpd_version >= '2.4.0' %>
+ LoadModule authz_core_module "<%= modules_dir %>/mod_authz_core.so"
+ LoadModule unixd_module "<%= modules_dir %>/mod_unixd.so"
+<% end %>
LoadModule passenger_module "<%= @mod_passenger %>"
PassengerRoot "<%= @passenger_root %>"
@@ -57,6 +61,11 @@ MaxClients 10
MaxSpareThreads 1
ThreadsPerChild 2
</IfModule>
+<IfModule mpm_event_module>
+ MinSpareThreads 1
+ MaxSpareThreads 1
+ ThreadsPerChild 2
+</IfModule>
<Directory />
AllowOverride all
@@ -66,12 +75,14 @@ ServerAdmin admin@passenger.test
ServerName passenger.test
DocumentRoot "<%= @server_root %>"
-LockFile <%= @server_root %>/httpd.lock
+<% if PlatformInfo.httpd_version < '2.4.0' %>
+ LockFile <%= @server_root %>/httpd.lock
+<% end %>
PidFile <%= @server_root %>/httpd.pid
ErrorLog <%= @passenger_root %>/test/test.log
CustomLog <%= @server_root %>/access.log combined
-<% if !vhosts.empty? %>
+<% if !vhosts.empty? && PlatformInfo.httpd_version < '2.4.0' %>
NameVirtualHost *:<%= @port %>
<% end %>
<% for vhost in vhosts %>
Please sign in to comment.
Something went wrong with that request. Please try again.