I have an nginx instance running on port 80 and another app (embedded jetty) running on the same machine on port 4567
.
I'm trying to redirect any request that includes /api/
in the URL, to the server running on port 4567
.
For this, I've added the following inside the http context tag in the nginx.conf
file:
server {
listen 80;
location /api {
proxy_pass http://127.0.0.1:4567;
}
}
But this is not working. I simply get a 404 Not Found
from nginx whenever I try to request any URL that includes /api/
*.
What am I missing?
Thanks.
Best Answer
I think you location is incorrect, use
Add slash in the end of your location.