On the configuration of nginx for vue Project in production Environment

I set the reverse proxy code at the front end as follows

proxyTable: {
  "/API":{
    target: "http://dev.snhb.group:9090",
   // target: "192.168.31.110:9090",
    changeOrigin: true,
    secure: false,
    pathRewrite: {
      "^/API":"/"
    }
  }
},

:
export function listLineSelect() {
return request({
    url: "/API/pcms/pcms/alarm/listAllLine",
    method: "post",
    baseURL: "",
    params: {}
})

}

there is no problem with the development environment
but such problems are encountered in the production environment
Request URL: http://localhost:9090/API/pcms/security/sso/ajaxcheck?account=gmservice&password=123546
Request Method: POST
Status Code: 404
Remote Address: 127.0.0.1
Referrer Policy: no-referrer-when-downgrade

I want to become this request http://localhost:9090/pcms/security/sso/ajaxcheck?

so I tried to configure
server {

on nginx as follows
    listen       9090;
    server_name  localhost;

    -sharpcharset koi8-r;

    -sharpaccess_log  logs/host.access.log  main;
    
    location ~* /api/ {
        proxy_pass  http://dev.snhb.group:9090;
        root   html;
        index  index.html index.htm;
    }
    

doesn"t work. I don"t know if you have any good ideas. Thank you

Jun.14,2022

listen       9090; // 9090  9000
server_name  localhost;

-sharpcharset koi8-r;

-sharpaccess_log  logs/host.access.log  main;

location / {
    root   "";
    index  index.html index.htm;
}

-sharp-sharp-sharp
location /API/ { // API  
    proxy_pass  http://dev.snhb.group:9090/; //    /API/
    proxy_redirect  off;
    proxy_set_header  Host $host;
    proxy_set_header  X_Real_IP $remote_addr;
    proxy_set_header  X_Forwarded_For $proxy_add_x_forwarded_for;
    proxy_connect_timeout  150;
    proxy_read_timeout  300;
    proxy_send_timeout  300;
}

then nginx restarts


my configuration looks like this. No problem

    listen       4000;
    server_name  127.0.0.1;
    root        /mnt/e/work/management/dist/;

    location / {
      index  index.html;
    }
    location /api/ {
      proxy_pass http://127.0.0.1:3000/;
    }
Menu