public
Description: An awesome Ruby blog engine.
Home | Edit | New

Deploying Thoth

When you run thoth -d start to start Thoth, what you’re actually doing is starting an instance of Ramaze using Thin to handle connections. By default, Thoth listens for connections on port 7000 of all network adapters. You can change this by editing thoth.conf.

If you wanted to, you could configure Thoth to listen on port 80 and then you could use it as your sole public web server. That’s probably not ideal, though, if you want detailed access logs, or if you need to host multiple websites on the same server. For this reason, it’s usually best to use another server such as Apache, Nginx, or Lighttpd to proxy requests to Thoth.

Below are some example config files illustrating how to configure different servers to run Thoth. Primary development and testing of Thoth is done using Apache, so your mileage with the other servers may vary. If you run into problems or would like to suggest an improvement, please leave a comment.

Shared hosting environments using CGI or FastCGI are not currently supported.

Apache

Enable mod_proxy and mod_proxy_http. Then use a virtual host config like the following:

<VirtualHost *>
  ServerName example.com
  
  # Tell Apache where to log requests and errors (optional).
  CustomLog /var/log/example.com-access.log combined
  ErrorLog  /var/log/example.com-error.log

  # Pass all requests to Thoth on port 7000.
  ProxyPreserveHost On
  ProxyPass         / http://127.0.0.1:7000/
  ProxyPassReverse  / http://127.0.0.1:7000/
</VirtualHost>

Nginx

server {
  server_name example.com;
  
  access_log /var/log/example.com-access.log main;
  error_log  /var/log/example.com-error.log;
  
  location / {
    proxy_set_header X-Real-IP       $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host            $http_host;
    
    proxy_pass http://127.0.0.1:7000/
  }
}

Lighttpd

Enable mod_proxy by adding it to lighttpd’s server.modules list, then add a rule like this one to pass requests to Thoth:

$HTTP["host"] =~ "example\.com" {
  proxy.server = ("" => (("host" => "127.0.0.1", "port" => 7000)))
}
Last edited by rgrove, Sun Feb 01 20:51:55 -0800 2009
Home | Edit | New
Versions: