I recently started hosting a website with Apache with friends and made a few subdomains for each persons' area. I did the DNS records and all of them work and reverse proxy to the correct subdomain.... all except for mail. No matter whether I put in the actual email server or just my test subdomain for the reverse proxy, it always comes back with ERR_CONNECTION_REFUSED. I have tried everything from switching the document roots to a subdomain that I know works and to ports that I know are being properly handled, but mail just doesn't seem to want to cooperate. I have Linked an abridged version of my main conf file below. The ports.conf has it listening to the ports being used as well.
<VirtualHost *:80>
ServerName mail.my-site.com
DocumentRoot "/var/www/email/"
ProxyPass "/" "http://127.0.0.1:8080/"
ProxyPassReverse "/" "http://127.0.0.1:8080/"
<Location />
Order allow,deny
allow from all
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName test.my-site.com
DocumentRoot "/var/www/test"
ProxyPass "/" "http://127.0.0.1:8081/"
ProxyPassReverse "/" "http://127.0.0.1:8081/"
<Location />
Order allow,deny
allow from all
</Location>
</VirtualHost>
#host
<VirtualHost *:80>
ServerAdmin myemail@email
ServerName www.my-site.com
ServerAlias my-site.com
DocumentRoot /var/www/my-site
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/my-site>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Just to reiterate/clarify, I have flipped the mail and test subdomains (and their corresponding conf files) and test will still work bringing up the mail server but mail will not load the test page (basic apache index.html).
This is the conf file for test subdomain. mail is pretty much a mirror with the changed port and doc route and serverName until I find out why it will not load
<VirtualHost *:8081>
ServerName test.my-site.com
ServerAdmin myemail@email
DocumentRoot "/var/www/test"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/test>
Order allow,deny
allow from all
</Directory>
</VirtualHost>