Nginx:poxy\u将不同的位置传递到不同的端口

Nginx:poxy\u将不同的位置传递到不同的端口,nginx,nginx-reverse-proxy,nginx-location,nginx-config,Nginx,Nginx Reverse Proxy,Nginx Location,Nginx Config,因此,基本上,我希望将根位置(即传递到一个端口)和所有其他路由(即*传递到另一个端口)。我现在做的是: server { listen 80; listen [::]:80; server_name www.domain.com; location /pricing { proxy_pass http://localhost:4025; } location / {

因此,基本上,我希望将根位置(即传递到一个端口)和所有其他路由(即*传递到另一个端口)。我现在做的是:

server {
        listen 80;
        listen [::]:80;

        server_name www.domain.com;
        location /pricing {
                proxy_pass http://localhost:4025;
        }

        location / {
                proxy_pass http://localhost:4033;
        }
}
这是可行的,但我也有其他路线,如定价和子路线,如果我导航到这些路线,它就不会像预期的那样工作。那么,有没有像这样的全球解决方案:

location @other {
                    proxy_pass http://localhost:4025;
}
更新:

我已经这样做了,它解决了我的问题,但它可行吗

server {
    listen 80;
    listen [::]:80;
    
    server_name www.domain.com;

    location ~ [/](assets)(.*) {
                proxy_pass http://localhost:4025;
        }

    location ~ [/]((stylesheets)|(javascripts)|(images)|(fonts))(.*) {
                proxy_pass http://localhost:4033;
        }
    
    location ~ [^\/](.*) {
        proxy_pass http://localhost:4025;
    }

    location / {
                proxy_pass http://localhost:4033;        
    }
}

最简单、快捷的解决方案:

server {
    listen 80;
    listen [::]:80;
    
    server_name www.domain.com;
    
    location ~ [^\/](.*) {
        proxy_pass http://localhost:4025;
    }

    location / {
                proxy_pass http://localhost:4033;        
    }
}