且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NGINX:使用域/路径在同一服务器上的多个节点js应用程序

更新时间:2022-05-12 06:15:19

要分配域/路径时,是否应该始终修改应用程序?

Should you always modify the application when you want to assign a domain/path?

不,您根本不需要修改应用程序.

No, you shouldn't have to modify the application at all.

以这种方式使用proxy_pass时,需要用正则表达式重写URL.尝试这样的事情:

When you use proxy_pass in this manner, you need to rewrite the URL with regex. Try something like this:

  location ~ ^/app1/(.*)$ { 
    proxy_pass http://localhost:8080/$1$is_args$args; 
  }

另请参阅: https://serverfault.com/q/562756/52951