How to correctly change the location directive in nginx?

77 Views Asked by At

I implemented a simple REST API using Falcon and running it with Gunicorn. An example call looks like this

curl "http://localhost:5000/articles?limit=100"

Now I'm trying to make the API accessible using nginx, and I actually got it working using the following config file for nginx

server {
    listen 80;
    server_name xxx.xxx.xxx.xxx;

    location / {
        include proxy_params;
        proxy_pass http://localhost:5000;
    }
}

With this I can go to http://xxx.xxx.xxx.xxx/articles?limit=100 to get the respective response. The only thing I would like to do now is to change the location directive. When I change the config file to

server {
    listen 80;
    server_name xxx.xxx.xxx.xxx;

    location /test/ {
        include proxy_params;
        proxy_pass http://localhost:5000;
    }
}

I would assume that http://xxx.xxx.xxx.xxx/test/articles?limit=100 will again give me the correct response, but I get an 404. Using /test instead of /test/ doesn't help either. What am I missing?

0

There are 0 best solutions below