Heim  >  Fragen und Antworten  >  Hauptteil

nginx – Bitte sagen Sie mir, wie ich die Konfiguration schreiben soll, wenn https://api.***.com implizit mit Parametern zu https://www.***.com/api/ springt.

Bitte sagen Sie mir, wie ich die Konfiguration schreiben soll, wenn https://api.XXX.com mit impliziten Parametern zu https://www.XXX.com/api/ springt

曾经蜡笔没有小新曾经蜡笔没有小新2714 Tage vor628

Antworte allen(4)Ich werde antworten

  • 高洛峰

    高洛峰2017-05-16 17:09:01

    rewrite ^/(.*)$ https://www.XXX.com/api/$1 permanent;

    Antwort
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-16 17:09:01

    可以在api..com上配置反向代理指向 www..com/api/

    Antwort
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:09:01

    server {
        ...
        server_name api.xxx.com;
        location / {
            proxy_pass www.xxx.com/api/;
        }
    }

    Antwort
    0
  • 伊谢尔伦

    伊谢尔伦2017-05-16 17:09:01

    建议使用nginx代理,打开nginx.conf

    增加一个新的server block

    server {
        server_name api.xxx.com;
        location / {
            proxy_pass www.xxx.com/api/;
        }
    }

    Antwort
    0
  • StornierenAntwort