简体   繁体   English

如何在bitnami MEAN堆栈服务器上托管两个节点应用程序?

[英]How to host two node applications on bitnami MEAN stack server?

I have hosted two node application on Bitnami Mean stack server by taking reference from this link 我通过参考此链接在Bitnami Mean堆栈服务器上托管了两个节点应用程序

Problems 问题

1) According to this documentation my application should run on http://[your-IP-address]/myapp url but it is opening directly at http://[your-IP-address] . 1)根据此文档,我的应用程序应在http:// [your-IP-address] / myapp url上运行,但它直接在http:// [your-IP-address]打开。

2) I have hosted two node applications running at 4000 and 5000 port. 2)我托管了两个运行在4000和5000端口的节点应用程序。 When you hit on ip it opens that application which is firstly placed in this file "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf". 点击ip后,它会打开该应用程序,该应用程序首先放在此文件“/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf”中。

content of 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) How to map url to open specific application. 3)如何映射url以打开特定的应用程序。

App1 settings -> httpd-app.conf App1设置 - > httpd-app.conf

ProxyPass / http://127.0.0.1:5000/ 
ProxyPassReverse / http://127.0.0.1:5000/

App2 settings -> httpd-app.conf App2设置 - > httpd-app.conf

ProxyPass / http://127.0.0.1:4000/ 
ProxyPassReverse / http://127.0.0.1:4000/

You have to map different paths at ProxyPass and ProxyPassReverse in httpd-app.conf from each application. 您必须在httpd-app.conf中的ProxyPassProxyPassReverse中映射来自每个应用程序的不同路径。

App1 settings -> httpd-app.conf 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 settings -> httpd-app.conf 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/

You should add both /app1/ and /app1 to match the app root address with /app1 and the rest of the addresses with /app1/ . 您应该添加/app1//app1以使用/app1匹配应用程序根地址,并使用/app1/其余地址。 Otherwise the proxy wont be able to map your requests correctly in both cases. 否则,代理将无法在两种情况下正确映射您的请求。

If you want to map one of your applications as root (/), make sure to place that include at the end in your bitnami-apps-prefix.conf file: 如果要以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"

Root application settings -> httpd-app.conf 根应用程序设置 - > httpd-app.conf

ProxyPass / http://127.0.0.1:3000/ 
ProxyPassReverse / http://127.0.0.1:3000/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM