On my self-hosted server, I've got an Apache serving several websites. On the same machine, I've also got other services that don't run on Apache. I bought a domain name. Here is what I'm trying to do:
- domain.tld redirects to /var/www/site1
- sub1.domain.tld redirects to localhost:8080
- sub2.domain.tld redirects to localhost:8081
Here is what I've tried:
<VirtualHost domain.tld:80>
ServerName domain.tld
DocumentRoot /var/www/site1
</VirtualHost>
<VirtualHost sub1.domain.tld:80>
ServerName sub1.domain.tld
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
<VirtualHost sub2.domain.tld:80>
ServerName sub2.domain.tld
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/
</VirtualHost>
Now, if I enable only one virtual host at the time, it works. But when multiple virtual hosts using proxy directive are enabled at the same time, they always redirect to the same proxy.
What can I do to make this work ? Any suggestions ?
Thanks in advance ! :)