nginx passenger standalone prevent proxy_pass on subdirectory

36 views
Skip to first unread message

Kuamanet

unread,
Jul 5, 2017, 5:33:10 AM7/5/17
to Phusion Passenger Discussions
i'm running nginx as reverse proxy for passenger standalone rails server. I need to set up root /location on passenger standalone port (5000) but few other subdirectories must be served by "pure" nginx. I'm trying configurations like
server {
    listen
443;

    root
/path/to/rails/public;

    server_name example
.com;

    ssl on
;
   
# ... some ssl config

   
# this is used for passenger standalone on port 5000
    location
/ {
            proxy_pass https
://127.0.0.1:5000;
            proxy_http_version
1.1;
            proxy_set_header
Host $http_host;
            proxy_set_header
Upgrade $http_upgrade;
            proxy_set_header
Connection $connection_upgrade;
            proxy_buffering off
;
   
}

   
# this is not passenger standalone!
    location
/subdir {
            proxy_pass https
://127.0.0.1;
            auth_basic
"Restricted access area authorization needed.";
            auth_basic_user_file
/path/to/.htpasswd;
   
}
}
but https://example.com/subdir/ return always 404 error. Any tips to fix it?

Daniel Knoppel

unread,
Jul 6, 2017, 5:42:10 AM7/6/17
to Phusion Passenger Discussions
Your config works for me (/ goes to passenger, /subdir asks for authentication) so it must be something else that's wrong, maybe the server you're querying is not the one you think it is, or not using the config you showed here.

- Daniel
Reply all
Reply to author
Forward
0 new messages