How do I proxy_pass to a unix socket in a server location other than root?

70 views Asked by At

I can proxy_pass using the root location like this:

server {
    listen 80;

    server_name mysite.com www.mysite.com;

    location / {
        proxy_pass http://unix:/home/myuser/app/run/gunicorn.sock;
    }
}

And if I curl mysite.com I see the expected JSON output.

But how can I make this available at curl mysite.com/myapi/? If I use location /myapi/ or location /myapi it doesn't work. I have also tried sticking an alias /; in there but that doesn't seem to work either.

0

There are 0 answers