S
S
Sergey2016-10-01 00:46:42
linux
Sergey, 2016-10-01 00:46:42

Why doesn't proxy_pass work in nginx?

In the config I write
location /cloud/ {
proxy_pass http://localhost:8000;
}
But I don't see the content from someipaddress:8000 under the someipaddress/cloud link , why? someipaddress:8000 - Works great! Also I can wget localhost:8000 and it works i.e. You can see everything on localhost. What am I doing wrong? tried both 127.0.0.1 and server ip in proxy_pass - to no avail.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Yankovsky, 2016-10-01
@webpavilion

Because the request is sent to localhost:8000 in the same form as it was received. the call goes to localhost:8000/cloud and through wget you pull localhost:8000
Accordingly, you need to add / like this should work:

location /cloud/ {
   proxy_pass http://localhost:8000/;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question