Apache vhost configuration for port forwarding

apache-2.2reverse-proxyvirtualhost

I am trying to get the hang of the reverse proxy features in Apache. I am using the Bitnami RubyStack on Windows Server 2012. The following configuration makes Apache not even to start – the error.log doesn't seem to be any helpful about what is going wrong.

<VirtualHost *:80>
  ServerName mydomain.nl
  ServerAlias mysub.mydomain.nl

  # this is a Rails application
  DocumentRoot "C:/Bitnami/rubystack-2.0.0-17/projects/dummy"

  RewriteEngine On

  <Proxy balancer://thinservers>
    BalancerMember http://127.0.0.1:3001
  </Proxy>

  # Redirect all non-static requests to thin
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]

  # Custom log file locations

  ErrorLog  "C:/Bitnami/rubystack-2.0.0-17/projects/dummy/log/error.log"
  CustomLog "C:/Bitnami/rubystack-2.0.0-17/projects/dummy/log/access.log"

</VirtualHost>

What I am trying to achieve is to forward incoming requests on port 80 to 3001.
I think however there might be a problem, as the Bitnami document root is also configured.

I am not really comfortable within Apache. I have included the modules for the proxy features I needed. As long as I don't include the vhosts, Apache will start fine. Yet, I have no clue what Rewriting and BalanceMember are supposed to do.

EDIT: after some permission checking, I got Apache started, but I get an Internal Server Error when accessing port 80.

No protocol handler was valid for the URL /. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

Best Answer

After some digging, I found something similar that just nails it. I found obscure tutorials, even bad links on the Apache doc section. So, for everyone who really doesn't care about Apache ins-and-outs, but just wants their Rails apps to fly with reverse proxy on the Bitnami Rubystack.

Include the vhosts in the main configuration file (httpd-conf) Add your customized vhost entry in the extra/vhosts.conf

NameVirtualHost *:80

    <VirtualHost *:80>
        DocumentRoot "YOUR_BITNAMI_INSTALL_DIR/rubystack-2.0.0-17/projects/dummy/public"
        ServerName your-subdomain.domain.com

    ProxyPass / http://localhost:3001/
    ProxyPassReverse / http://localhost:3001/

    </VirtualHost>

Does the trick perfectly!