I am trying setup Apache to have multiple routes/links/sub-directory for multiple apps (node.js app, react app)
For example,
And these apps would start on its individual ports like app1 runs on port 81, app2 runs on port 82,… and so on.
I had already try to create a virtualhost in /etc/apache2/sites-available/newRoute.conf
<VirtualHost *:80>
ServerName mydomainname.net
ServerAlias www.mydomainname.net
ServerAdmin name@hotmail.com
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:3000/$1 [P,L]
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
<VirtualHost *:80>
ServerName mydomainname.net/test
ServerAlias www.mydomainname.net/test
ServerAdmin name@hotmail.com
ProxyPass /test http://localhost:81/
ProxyPassReverse /test http://localhost:81/
</VirtualHost>
but it didn’t work out. I started the node.js app on port 81 and browse to mydomainname.net/test, and it just display my mydomainname.net content.
In addition, localhost:3000 is just a react app which has homepage content
Also, the node.js app which running on localhost:81 would print “hello world” on the screen.
Thank
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
@chiKaRauT Use Location tag as follows
Hope this helps.