Skip to content

Commit

Permalink
Nginx: fixes cases in which Passenger overrides the Nginx handler fun…
Browse files Browse the repository at this point in the history
…ction even when it shouldn't

For example when Passenger is disabled. Closes phusionGH-1393.
  • Loading branch information
FooBarWidget authored and oshchukin committed Mar 4, 2015
1 parent c638145 commit 41a6576
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -3,6 +3,7 @@ Release 5.0.1

* The `passenger-config restart-app` command is now more user friendly. When run in a terminal, it will show an interactive menu, allowing you to select the app to restart. Closes GH-1387.
* Fixes a crash bug in the handling of sticky session cookies.
* [Nginx] Fixes cases in which Passenger overrides the Nginx handler function even when it shouldn't, for example when Passenger is disabled. Closes GH-1393.
* [Enterprise] The `sticky_sessions` and `envvars` options in Passengerfile.json is now also supported in mass deployment mode.


Expand Down
12 changes: 12 additions & 0 deletions doc/Users guide Nginx.txt
Expand Up @@ -430,6 +430,18 @@ Please see <<deploying_a_rack_app,Deploying a Rack-based Ruby application>>
and <<deploying_a_wsgi_app,Deploying a WSGI (Python) application>>
for examples.

------------------------------
server {
listen 80;
server_name www.example.com;
root /webapps/example/public;

# You must explicitly set 'passenger_enabled on', otherwise
# Phusion Passenger won't serve this app.
passenger_enabled on;
}
------------------------------

[[PassengerBaseURI]]
==== passenger_base_uri <uri>
Used to specify that the given URI is an distinct application that should
Expand Down
5 changes: 4 additions & 1 deletion ext/nginx/Configuration.c
Expand Up @@ -745,7 +745,10 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
conf->upstream_config.upstream = prev->upstream_config.upstream;
}

if (conf->enabled) {
if (conf->enabled == 1 /* and not NGX_CONF_UNSET */
&& passenger_main_conf.root_dir.len != 0
&& clcf->handler == NULL /* no handler set by other modules */)
{
clcf->handler = passenger_content_handler;
}

Expand Down

0 comments on commit 41a6576

Please sign in to comment.