Apache ProxyPass:独立与位置标签?
Apache ProxyPass: standalone vs location tag?
这两个代码块有何不同?
ProxyPass /app http://10.0.0.10/blah
ProxyPassReverse /app http://10.0.0.10/blah
对比
<Location /app>
ProxyPass http://10.0.0.10/blah
ProxyPassReverse http://10.0.0.10/blah
</Location>
谢谢!
这只是风格上的差异,没有功能上的差异。如果您开始添加更多仅适用于 /app 的选项,您可能会发现后者更直接,因为它们都位于 Location 容器中。
使用 Location
指令是首选方法。像这样 ProxyPass /app http://10.0.0.10/blah
这样的 Proxypass
的替代语法在有很多时会对性能产生影响。但是,根据您的需要,替代语法可能会更好。
来自文档:
The following alternative syntax is possible, however it can carry a
performance penalty when present in very large numbers. The advantage
of the below syntax is that it allows for dynamic control via the
Balancer Manager interface:
ProxyPass "/mirror/foo/" "http://backend.example.com/"
请查看文档以获取更多信息。
http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass
这两个代码块有何不同?
ProxyPass /app http://10.0.0.10/blah
ProxyPassReverse /app http://10.0.0.10/blah
对比
<Location /app>
ProxyPass http://10.0.0.10/blah
ProxyPassReverse http://10.0.0.10/blah
</Location>
谢谢!
这只是风格上的差异,没有功能上的差异。如果您开始添加更多仅适用于 /app 的选项,您可能会发现后者更直接,因为它们都位于 Location 容器中。
使用 Location
指令是首选方法。像这样 ProxyPass /app http://10.0.0.10/blah
这样的 Proxypass
的替代语法在有很多时会对性能产生影响。但是,根据您的需要,替代语法可能会更好。
来自文档:
The following alternative syntax is possible, however it can carry a performance penalty when present in very large numbers. The advantage of the below syntax is that it allows for dynamic control via the Balancer Manager interface:
ProxyPass "/mirror/foo/" "http://backend.example.com/"
请查看文档以获取更多信息。
http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypass