webman路由转发问题求教

superlow

我有个域名是 api.xx.com/activity
我想让 api.xx.com/activity 的内容由webman解析,其他的内容由其他语言实现。
这样的情况下我的路由应该怎么配置呢,我的webman是多应用,并且每个应用都是基于 api.xx.com/activity 来访问的,比如a b c应用:
api.xx.com/activity/a
api.xx.com/activity/b
api.xx.com/activity/c
请教大佬!

1911 3 3
3个回答

walkor

用nginx做代理,nginx关键配置如下

location /activity {
    proxy_pass   http://127.0.0.1:8787;
}
  • superlow 2021-01-13

    嗯嗯,我现在就是这样做的,然后在route.php里面配置的话是这样:Route::any('/activity/index/index', 'app\controller\index@index'); 可以支持只绑定到控制器吗,这样可以少写一下路由规则

walkor

路由改成这样,访问/activity/index/index会自动访问 'app\controller\index@index,不用配置路由。

location /activity/ {
    rewrite ^/activity(/.*)$ $1 break;
    proxy_pass   http://127.0.0.1:8787;
}
superlow

可以用,感谢大佬!!!

  • 暂无评论
年代过于久远,无法发表回答
🔝