Apache mod_proxy

Posted by mhouston100 on Server Fault See other posts from Server Fault or by mhouston100
Published on 2014-08-20T07:44:50Z Indexed on 2014/08/20 10:23 UTC
Read the original article Hit count: 225

Filed under:
|
|

Uggh, I'm spewing that I can't figure this out, I'm so frustrated:

    <VirtualHost *:80>
        servername domain1.com.au
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <Proxy *>
          Order Allow,Deny
          Allow from all
        </Proxy>

        RewriteEngine on
        ReWriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
</VirtualHost>

<VirtualHost *:443>

        servername domain1.com.au

        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/owncloud.pem
        SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
        DocumentRoot /var/www/html

</VirtualHost>

<VirtualHost *:*>
        Servername domain2.com.au
        ProxyRequests Off
        <Proxy *>
          Order deny,allow
          Allow from all
        </Proxy>

        ProxyPass / https://192.168.1.12/
        ProxyPassReverse / https://192.168.1.12/
</VirtualHost>

Not sure if it's clear what I'm trying to do, but I've read and read and READ, I still can't figure it out.

Basically I have a working Apache server with a rewrite to force HTTPS, as seen in the first two VirtualHost entries. I now have a webmail service I set up on another server, under another domain name, however I only have one incoming public IP address.

So I'm trying to have any incoming requests for the second domain to be proxied to the other server to access the webmail, whether its port 80 or 443.

IMAP and POP3 are no problems, I can just forward the ports directly to the correct server.

The results of the above configuration is that requests to domain2.com.au (port 80 or 443) are forwarded to https://domain1.com.au.

Am I headed in the right direction?

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about mod-rewrite