NGINX 根据端点重定向到不同的服务器

时间:2021-04-09 17:10:29

标签: nginx nginx-config

我需要将 http://example.com/api/v1 之类的请求重定向到 http://sub.example.com/api/v1
http://example.com/http://another-example.com/

这是我目前尝试过的:

 server {
            listen       80;
            server_name  http://example.com/api/v1;
            return 200 http://sub.example.com/api/v1$request_uri;

它有效,现在我正在尝试添加如下内容:

        server_name  http://example.com/;
        return 200 http://another-example.com/$request_uri;

重定向不起作用,我做错了什么?

0 个答案:

没有答案
相关问题