我通过参考
link来在Bitnami Mean堆栈服务器上托管了两个节点应用程序
问题
1)根据此文档,我的应用程序应在http://[your-IP-address]/myapp url上运行,但它将在http://[your-IP-address]直接打开.
2)我托管了两个运行在4000和5000端口的节点应用程序.当你点击ip它会打开那个首先放在这个文件中的应用程序
“/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf”.
bitnami-apps-prefix.conf的内容
# Bitnami applications installed in a prefix URL
Include "/opt/bitnami/apps/app1/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/app2/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/rockmongo/conf/httpd-prefix.conf"
3)如何映射url以打开特定的应用程序.
App1设置 – >的httpd-app.conf
ProxyPass / http://127.0.0.1:5000/
ProxyPassReverse / http://127.0.0.1:5000/
App2设置 – >的httpd-app.conf
ProxyPass / http://127.0.0.1:4000/
ProxyPassReverse / http://127.0.0.1:4000/
最佳答案 您必须在httpd-app.conf中的ProxyPass和ProxyPassReverse中映射来自每个应用程序的不同路径.
App1设置 – >的httpd-app.conf
ProxyPass /app1/ http://127.0.0.1:5000/
ProxyPassReverse /app1/ http://127.0.0.1:5000/
ProxyPass /app1 http://127.0.0.1:5000/
ProxyPassReverse /app1 http://127.0.0.1:5000/
App2设置 – >的httpd-app.conf
ProxyPass /app2/ http://127.0.0.1:4000/
ProxyPassReverse /app2/ http://127.0.0.1:4000/
ProxyPass /app2 http://127.0.0.1:4000/
ProxyPassReverse /app2 http://127.0.0.1:4000/
您应该添加/ app1 /和/ app1以使用/ app1匹配应用程序根地址,并使用/ app1 /添加其余地址.否则,代理将无法在两种情况下正确映射您的请求.
如果要以root(/)映射其中一个应用程序,请确保将最后包含的内容放在bitnami-apps-prefix.conf文件中:
# Bitnami applications installed in a prefix URL
Include "/opt/bitnami/apps/app1/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/app2/conf/httpd-prefix.conf"
Include "/opt/bitnami/apps/rootapp/conf/httpd-prefix.conf"
根应用程序设置 – >的httpd-app.conf
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/