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
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].

  2. I have hosted two node applications running at 4000 and 5000 port. 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”.
    content of bitnami-apps-prefix.conf

Bitnami applications installed in a prefix URL

Include “/opt/bitnami/apps/searchapi/conf/httpd-prefix.conf”
Include “/opt/bitnami/apps/dicomdemo/conf/httpd-prefix.conf”
Include “/opt/bitnami/apps/rockmongo/conf/httpd-prefix.conf”

  1. How to map url to open specific application.
    App1 settings -> httpd-app.conf

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

App2 settings -> httpd-app.conf

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

Hi @varun_nayyar405

It seems that you are not configuring Apache properly since you are configuring both of them at /. Please apply these changes at your http-app.conf:
App1 settings -> httpd-app.conf

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

App2 settings -> httpd-app.conf

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

I hope this information helps you. If you have any other issue, please do not hesitate to let us know.

Regards,

Juan

Hi,

Your solution worked for multiple node applications but the internal pages (url’s) are showing 404 error. What am i missing here?

Hi @sumit.shairya,

You mean that the links that the application generates can’t be found because they are not using /myapp1 or /myapp2, right? I think you will need to configure the route in your applications to use /myapp1 and /myapp2 when running the express server so you can configure Apache with these lines

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

This way, no matter if you access the application using the express server directly or through Apache, you will use the same route.

Happy to help!


Was my answer helpful? Click on :heart:

Hi @jota,

Thanks for your help, but when I use ProxyPass /myappX http://127.0.0.1:5000/myappX instead of ProxyPass /myappX http://127.0.0.1:5000/ my application doesn’t work (404 for home page).

ProxyPass / http://127.0.0.1:5000/ works perfectly and all pages of the application are accessible but this way only 1 application can be accessed. Please suggest.

Hi @sumit.shairya,
Did you try to change the location of the applications from / to /myappX?
The 404 error is due to the path /myappX does not exist and if I am not wrong you are trying to set it as the root path for the app, right?