0

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.

MiningSam
  • 161
  • 1
  • 10
  • See [Why not use a WAMP stack?](http://serverfault.com/q/453617/126632) for the reasons why this setup is not a good idea. – Michael Hampton Sep 07 '14 at 14:30
  • What does a WAMP stack have to do with Reverse Proxy configuration? Besides - the P stands for PHP. I am using a Rails app. – MiningSam Sep 07 '14 at 17:44
  • The issues are exactly the same. – Michael Hampton Sep 07 '14 at 17:49
  • Using a stack for development reasons shouldn't be the real issue - I totally agree on such agreements not to use them in production environments. However, my question means that I've no real knowledge about Apache setup. There are tons of examples, but I have no real clue *how* I am supposed to achieve what I want - it wouldn't make a real difference with a regular setup. – MiningSam Sep 07 '14 at 21:04

1 Answers1

4

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!

MiningSam
  • 161
  • 1
  • 10
  • I have tried this but get error `Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details. ` – zukijuki May 12 '20 at 06:17