Score:0

redirect nginx from port to another port and subdirectory nginx

br flag
CFD

I have a service running on: http://localhost:49159 I created an nginx docker to forward the service from port 49 to 8080 by the following

nginx.conf:
user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include mime.types;
    sendfile on;
    upstream aspnetapp {
    server 127.0.0.1:49159;

}

    server {
    listen       8080;
    resolver 127.0.0.11;
    autoindex off;
    
    server_name localhost;
    server_tokens off;

    location / {
        
       proxy_pass http://172.17.0.1:49159;
    }
}
}

so by now, I can forward all the request from http://localhost:49159 to http://localhost:8080

Now, I want to forward all the requests from http://localhost:49159 to http://localhost:8080/service/. so all the requests will be redirected to /service/ subdirectory of 8080.

Preferably, I don't want to change my service config. I hope I can make this change by changing nginx.conf

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.