Heim  >  Fragen und Antworten  >  Hauptteil

Nginx schreibt regulären Ausdruck neu

http://localhost/action
http://localhost/action/pre/xx/xx

Alle Aktionsschnittstellen werden von Tomcat verwaltet, aber um gleichzeitig auf die beiden oben genannten URLs zugreifen zu können, habe ich die folgenden beiden Standortsegmente konfiguriert. Ich habe immer das Gefühl, dass diese Konfigurationsmethode nicht sehr elegant ist ist ein besserer Weg. Es ist nicht ganz klar

location ~ ^/(action)/?$ {
    proxy_pass  http://tomcats;
}

location ~ ^/(action)/(.+)$ {
    proxy_pass  http://tomcats;
}
巴扎黑巴扎黑2709 Tage vor733

Antworte allen(2)Ich werde antworten

  • phpcn_u1646

    phpcn_u16462017-05-21 18:59:24

    你好,请问一下

    thinkPHP3.2留言板视频教程

    原地址是什么,我想去研究一下。

    Antwort
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-19 10:50:22

    看你的需要求,直接

    location ^~ /action/{
        proxy_pass  http://tomcats;
    }

    应该就行了。

    Antwort
    0
  • StornierenAntwort