1

I'm trying to configure lighttpd so that it serves static documents of my Ruby on Rails app, and also routes requests to my Ruby on Rails app servers.

This is the configuration I have so far:

$HTTP["host"] =~ "(^|www\.)brlafreniere.com$" {
    proxy-core.protocol = "http"
    proxy-core.balancer = "hash"
    proxy-core.backends = (
        "127.0.0.1:5000",
        "127.0.0.1:5001",
        "127.0.0.1:5002",
    )       

    server.document-root = "/var/www/brlafreniere.com/public"
}       

With this configuration in place, hitting brlafreniere.com in my browser results in 404 not found.

I did curl 127.0.0.1:5000 and received the expected response, the front page of my Ruby on Rails app.

I'm using the following script to start the app servers.

#!/bin/bash

RAILS_ENV=production rake assets:clobber assets:precompile

puma --pidfile /tmp/brlafreniere.com.1 --environment production --port 5000 > log/puma.log 2>&1 &
puma --pidfile /tmp/brlafreniere.com.2 --environment production --port 5001 > log/puma.log 2>&1 &
puma --pidfile /tmp/brlafreniere.com.3 --environment production --port 5002 > log/puma.log 2>&1 &

Is there a way I can tweak this to get more log output? The log output is not being very helpful. :)

1 Answer 1

0

It looks as though I needed to use the proxy module instead of proxy-core.

I also set Rails to refer to assets via config.action_controller.asset_host in config/environments/production.rb, by setting to http://assets.brlafreniere.com and set up a directive in my lighty config which captures $HTTP["host"] == "assets.brlafreniere.com" and then sets the server.document-root accordingly, and everything works beautifully now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .