I can't seem to make this nginx config work. I have a rails app, and I need to proxy everything under a path to a Java/Tomcat setup. I have another route (which does hit the main rails app) under lockdown and that works, but the proxy_pass
doesn't; it just hits the main app.
lockdown
location directive, it works. location
directives has no effect. The basic config:
server {
listen 80;
root /rails/app/public;
rails_env development;
passenger_enabled on;
location /JavaApp {
proxy_pass http://127.0.0.1:8080/JavaApp/;
}
location /lockdown {
# Have to re-enable passenger
passenger_enabled on;
allow 127.0.0.1;
deny all;
}
}
What am I doing wrong?
I thought I had tried every combination, but I went through a bunch more and found that this worked:
location ~ \.jsp$
Which boggled my mind because before it whined about not allowing regex in the location with proxy_pass, but I had a path in the proxy pass line... SO!
This does the trick
location ~ /JavaApp {
proxy_pass http://127.0.0.1:8080;
}
Try removing passenger_enabled pn; from the top level of the server {} block and I think it will start working for you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.