0

i am trying to get nginx to pass

"your-domain.com/test" 

to

http://localhost:{9001}

i am new to nginx and had success with the following:

server {
    listen 80;

    server_name your-domain.com;

    location / {
        proxy_pass http://localhost:{9001};
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
    }
}

Now i am able to pass my domain to the port 9001. Now i want to adapt this in that way, that i am able to pass your-domain.com/test to localhost:{9001}. Is this possible? what do i have to change?

i tried

location /test
server_name your-domain.com/test

both without success.

3
  • you want both / and /test to pass to 9001 ? Commented Oct 5, 2013 at 3:49
  • i want your-domain.com/test to prox_pass to 9001. is this possible? Commented Oct 5, 2013 at 8:03
  • I believe you don't need to change any thing because location / will also match location /test so it will get proxy_passed also Commented Oct 5, 2013 at 8:51

1 Answer 1

1
location ~ /test

In fact, location need an operator (=, ~ ...) to match an uri. "location /" mean 'everything'.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.