I'm trying to setup an apache reverse proxy when accessing mysite.com to 127.0.0.1:3001, by setting up a virtual host in the WHM > Apache Configuration > Include Editor > Post VirtualHost Include (all versions).
I have a subdomain api.mysite.com (php) which is working and for front mysite.com I want to use a nodejs app that's running on server on localhost:3001.
This is what I have:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://127.0.0.1:3001/
ProxyPassReverse / http://127.0.0.1:3001/
</VirtualHost>
It only works for front when I remove virtual host and use only this part, but then it uses reverse proxy for all, even the api.mysite.com.
ProxyRequests Off
<Proxy *>
Require all granted
</Proxy>
ProxyPass / http://127.0.0.1:3001/
ProxyPassReverse / http://127.0.0.1:3001/
<VirtualHost>
definitions in the same file.VirtualHost
definitions in the same file. But the main thing that confuses me, is why is this<VirtualHost *:80>
definition ignored. And it only works when I set the proxy globally.<VirtualHost>
which overrides your config. Panel related questions are generally considered off topic here.