Dan Harper
2006-Jul-29 17:25 UTC
[Rails] Lighttpd Configuration Independent of Hostname or IP
Hopefully someone can help with a bit of lighttpd configuration for my production rails app in Mac OS X. I have an application which will be accessed by many different domains and IP addresses. Examples: http://crm.local/ http://localhost/ http://192.168.0.49/ http://65.256.120.90/ (fake, but you get the idea, an external Internet facing IP address) http://crm.mydomain.net/ My current config below only seems to work with "http://crm.local/" and I think it may be because of this line: $HTTP["host"] =~ "(www\.)?crm\.(local|mydomain.net)" { which to me would match "http://crm.local/", "http://www.crm.local/", "http://crm.mydomain.net/" or "http://www.crm.mydomain.net/" Is there a way to configure lighttpd independently from the hostname (like ignore it altogether, so if it gets a request on port 80 it just sends it to my rails app)? I can see the advantages for virtual domains or subdomains pointing to different apps, etc. But I''m planning on just having this one server serve one rails app but will be accessed through a few different IPs and hostnames. I can''t seem to find any examples on the Net and the lighttpd doco is woeful. Thanks, Dan PS, My current lighttpd.conf (the parts that matter): server.document-root = "/Users/CRMServer/var/www/kc/public" server.bind = "crm.local" server.port = 80 server.pid-file = "/Users/CRMServer/var/www/kc/log/ lighttpd.pid" server.tag = "lighttpd_crm_doncaster" server.username = "CRMServer" server.groupname = "CRMServer" accesslog.filename = "/Users/CRMServer/var/www/kc/log/ lighttpd.access.log" server.errorlog = "/Users/CRMServer/var/www/kc/log/ lighttpd.error.log" server.indexfiles = ( "index.php", "index.html", "index.htm", "default.htm" ) url.access-deny = ( "~", ".inc" ) $HTTP["host"] =~ "(www\.)?crm\.(local|mydomain.net)" { server.document-root = "/Users/CRMServer/var/www/kc/public/" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server= (".fcgi" => ("mydomain.net" => ( "socket" => "/Users/CRMServer/var/www/kc/tmp/sockets/ lighttpd-fcgi.socket", "bin-path" => "/Users/CRMServer/var/www/kc/public/ dispatch.fcgi", "bin-environment" => ("RAILS_ENV" => "production" ), "max-load-per-proc" => 4, "min-procs" => 1, "max-procs" => 2, "idle-timeout" => 60 ) ) ) }
Dan Harper
2006-Jul-29 17:34 UTC
[Rails] Lighttpd Configuration Independent of Hostname or IP
Hopefully someone can help with a bit of lighttpd configuration for my production rails app in Mac OS X. I have an application which will be accessed by many different domains and IP addresses. Examples: http://crm.local/ http://localhost/ http://192.168.0.49/ http://65.256.120.90/ (fake, but you get the idea, an external Internet facing IP address) http://crm.mydomain.net/ My current config below only seems to work with "http://crm.local/" and I think it may be because of this line: $HTTP["host"] =~ "(www\.)?crm\.(local|mydomain.net)" { which to me would match "http://crm.local/", "http://www.crm.local/", "http://crm.mydomain.net/" or "http://www.crm.mydomain.net/" Is there a way to configure lighttpd independently from the hostname (like ignore it altogether, so if it gets a request on port 80 it just sends it to my rails app)? I can see the advantages for virtual domains or subdomains pointing to different apps, etc. But I''m planning on just having this one server serve one rails app but will be accessed through a few different IPs and hostnames. I can''t seem to find any examples on the Net and the lighttpd doco is woeful. Thanks, Dan PS, My current lighttpd.conf (the parts that matter): server.document-root = "/Users/CRMServer/var/www/kc/public" server.bind = "crm.local" server.port = 80 server.pid-file = "/Users/CRMServer/var/www/kc/log/ lighttpd.pid" server.tag = "lighttpd_crm_doncaster" server.username = "CRMServer" server.groupname = "CRMServer" accesslog.filename = "/Users/CRMServer/var/www/kc/log/ lighttpd.access.log" server.errorlog = "/Users/CRMServer/var/www/kc/log/ lighttpd.error.log" server.indexfiles = ( "index.php", "index.html", "index.htm", "default.htm" ) url.access-deny = ( "~", ".inc" ) $HTTP["host"] =~ "(www\.)?crm\.(local|mydomain.net)" { server.document-root = "/Users/CRMServer/var/www/kc/public/" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server= (".fcgi" => ("mydomain.net" => ( "socket" => "/Users/CRMServer/var/www/kc/tmp/sockets/ lighttpd-fcgi.socket", "bin-path" => "/Users/CRMServer/var/www/kc/public/ dispatch.fcgi", "bin-environment" => ("RAILS_ENV" => "production" ), "max-load-per-proc" => 4, "min-procs" => 1, "max-procs" => 2, "idle-timeout" => 60 ) ) ) }
Hasan Diwan
2006-Jul-30 16:35 UTC
[Rails] Lighttpd Configuration Independent of Hostname or IP
Dan: On 7/29/06, Dan Harper <dan@danharper.org> wrote:> server.bind = "crm.local"server.bind = '''' server.bind = ''*'' One of those (untested as I don''t use lighttpd at this time) should work. -- Cheers, Hasan Diwan <hasan.diwan@gmail.com>
snacktime
2006-Jul-30 23:07 UTC
[Rails] Lighttpd Configuration Independent of Hostname or IP
On 7/30/06, Hasan Diwan <hasan.diwan@gmail.com> wrote:> Dan: > > On 7/29/06, Dan Harper <dan@danharper.org> wrote: > > server.bind = "crm.local" > > server.bind = '''' > server.bind = ''*''It''s server.bind = "0.0.0.0"