I am stuck getting started with containerized virtualhosts. The set up is as follows:
mydomain.com
- Ubuntu VPS (digitalOcean, for context), Docker pre installed
- Apache container (reverse proxy), guest port 80 to host 80
- Web-app container (running apache), guest port 80 to host 8081
Apache is serving fine, apache info page shows at mydomain.com and web-app shows at mydomain.com:8081
The issue is trying to ProxyPass sub.mydomain.com to serve mydomain.com:8081
I have devised the following sites-available/sub.mydomain.com.conf in the Apache container.
<VirtualHost *:80>
ServerName sub.mydomain.com
ProxyPreserveHost on
ProxyRequests off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass "/" "http://localhost:8081/" retry=0
ProxyPassReverse "/" "http://localhost:8081/"
However, sub.mydomain.com returns a 503 error.
I have also added the following DNS records with digitalOcean: - CNAME: *.mydomain.com is an alias of mydomain.com - A: sub.mydomain.com directs to [DROPLET IP]
I have also tried: replacing 'localhost' in :
ProxyPass "/" "http://localhost:8081/" retry=0
ProxyPassReverse "/" "http://localhost:8081/"
with mydomain.com and DROPLET IP and the [gateway] ip returned by route
executed from inside the Apache container. Changing to these values either gives the same 503 error, or results in the page continuously loading, returning neither an error nor the page requested. I am at a loss for what to try next, any help is appreciated. There are so many disparate settings that I think a more experienced individual might be able to point out where I have gone wrong. Thanks in advance!