Betrieb und Wartung – Kann Nginx Pfade außerhalb von IP und Port konfigurieren?
我想大声告诉你
我想大声告诉你 2017-05-16 17:18:37
0
2
403

Mein Programm ist zum Beispiel localhost:8080/demo/

Untertitelt in: localhost:9000/microsevice/demo, mit einem weiteren Microservice-Dienstnamen

我想大声告诉你
我想大声告诉你

Antworte allen(2)
我想大声告诉你

可能理解错你的意思了。
在用户浏览器URL里显示 localhost:8080/demo/,实际访问的是localhost:9000/microsevice/demo

server {
   listen 8080;
   location ^~ / {
        # 如果需要的话
        #proxy_set_header Host $host;
        #proxy_set_header X-Real-IP $remote_addr;
       proxy_pass http://localhost:9000/microsevice/;
   } 
}

在用户浏览器URL里显示localhost:9000/microsevice/demo,实际访问的是localhost:8080/demo/

server {
   listen 9000;
   location ^~ /microsevice/ {
        # 如果需要的话
        #proxy_set_header Host $host;
        #proxy_set_header X-Real-IP $remote_addr;
       proxy_pass http://localhost:8080/;
       # 最后那个 / 是必须的。
   } 
}
phpcn_u1582

可以,用proxy_pass

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!