Question: Currently my Ubuntu server runs RubyOnRails applications with Apache2 + Passenger.

Now I need to deploy a Sinatra (Plain Ruby app) which needs to run on Thin instead of Passenger.

I'm familiar with configuring Apache and would like to continue in that manner, with the VirtualHosts (in sites-available) etc..

How can I "route" a VirtualHost in Apache to a Thin server?

Answer: 
You'll be configuring Apache as a "reverse proxy" - that search term will point you to a wealth of information regarding the configuration, but here's an example that should get you most of the way to the deployment you're looking for.

If you'll be using a different hostname and different `<VirtualHost>`, then you can do something like this:

```
<VirtualHost *:80>
    ServerName sinatra.example.com
    # Any normal settings you use go here; access logs, ServerAdmin, etc

    # Replace the 9999 below with the port that thin is using, note that it can't
    # be the same as Apache's port.
    # This can also be a service running on adifferent computer if you
    # use another IP address instead of 127.0.0.1
    ProxyPass / http://127.0.0.1:9999/
    ProxyPassReverse / http://127.0.0.1:9999/
</VirtualHost>

```

An alternative configuration that may be of use to you would be to just make it a subdirectory of an existing `<VirualHost>`; you'd add a `<Location>` block to your existing config:

```
<Location /sinatra/>
    ProxyPass http://127.0.0.1:9999/
    ProxyPassReverse http://127.0.0.1:9999/
</Location>

```
You could use Varnish to route app requests. I did this at my last job on our RoR/Varnish/NGINX stack.

Besides, Varnish caching is awesome!