2017-04-02 40 views
0

通常情况下,做一个反向代理设置时,你有你的后端服务器,看起来像这样:NGINX反向代理与没有根子目录主机

http://localhost:8084/app-root

,你可以proxy_pass

location /app-root { proxy_pass http://localhost:8084; }

它会将www.my-domain.com/app-root代理到内部服务器http://localhost:8084/app-root

太棒了!

有人可以解释需要在服务器坚持从根托管作为这样做的事情:

http://localhost:8084/index.html http://localhost:8084/images/image1.jpg

我想这是通过

http://www.my-domain.com/app/index.html
http://www.my-domain.com/app/images/image1.jpg进行访问

回答

0

您可以使用重写nginx。像这样的东西应该工作

location /app/ { 
    rewrite /app/(.*) /$1 break; 
    proxy_pass   http://localhost:8084; 
}