New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx proxy_pass stop working when compiled with passenger 5.0.0.rc2 #1393

Closed
trongrg opened this Issue Feb 28, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@trongrg

trongrg commented Feb 28, 2015

Details:

  • OS: Centos 7
  • rvm: 1.26.10
  • ruby: 2.2.0
  • gem install passenger -v 5.0.0.rc2
  • passenger-install-nginx-module
  • choose recommended options (install nginx 1.6.2)
  • add a server directive
server {
  listen 80;
  server_name localhost;
  location / {
    proxy_pass http://localhost:9000;
  }
}
  • restart nginx

When I run curl -I localhost, it always return 404.

Passenger 4.0.59 works as expected

@FooBarWidget

This comment has been minimized.

Member

FooBarWidget commented Mar 1, 2015

What happens if you remove the passenger_root directive from your Nginx config file? Does that make proxy_pass work again?

@trongrg

This comment has been minimized.

trongrg commented Mar 1, 2015

@FooBarWidget Removing passenger_root directive from Nginx config file doesn't help

Following is a minimal nginx config that can reproduce the problem

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    #passenger_root /usr/local/rvm/gems/ruby-2.2.0@global/gems/passenger-5.0.0.rc2;
    #passenger_ruby /usr/local/rvm/gems/ruby-2.2.0@global/wrappers/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;
        location / {
            proxy_pass http://example.com;
        }
    }
}

curl command, it doesn't show content from proxy_pass, but always serves content from nginx

curl localhost
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>
@FooBarWidget

This comment has been minimized.

Member

FooBarWidget commented Mar 2, 2015

Problem reproduced. Working on a fix.

@FooBarWidget FooBarWidget added this to the 5.0.1 milestone Mar 2, 2015

@FooBarWidget

This comment has been minimized.

Member

FooBarWidget commented Mar 2, 2015

This issue has been fixed. There are several issues at work here.

The first is that your proxy_pass config had no effect even though Passenger is not enabled. This has been fixed.

The other issue is that passenger_enabled overrides the handler already set by another Nginx module, such as proxy_pass. This has also been fixed, by making sure that passenger_enabled directives are only inherited if no handler has already been set.

oshchukin added a commit to oshchukin/passenger that referenced this issue Mar 4, 2015

Nginx: fixes cases in which Passenger overrides the Nginx handler fun…
…ction even when it shouldn't

For example when Passenger is disabled. Closes phusionGH-1393.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment