Running Apache 2.4.58
I need to get Apache to serve example.com from a directory and all subdomains *.example.com to be ProxyPass / http://localhost:8050 (so they can be served from another web server dependent on the subdomain).
I can currently get it to ProxyPass absolutely everything to the other localhost server or serve the directory for example.com then all subdomains are not ProxyPassed so fail to serve as they never hit the other server.
I've tried doing multuple virutalhosts but I can't seem to get it to work.
<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName example.com
DocumentRoot /home/example/public_html
ErrorLog /var/log/apcache2/example_error_log
CustomLog /var/log/apache2/example_access_log combined
DirectoryIndex index.php index.php4 index.php5 index.htm index.html
<Directory /home/example/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
Require all granted
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
ServerAlias *.example.com
ProxyPass / http://localhost:8050/
ProxyPassReverse / http://localhost:8050/
</VirtualHost>
And a matching 443 version is under this.
Everything is passed to the Proxy when running the above. I thought it would do the first directives then the next. I have also tried with the last 3 lines at the top which made no difference.
Someone people help! It's driving me crazy. TIA.