I have a rails app on a debian server running lighttpd and I''m trying to set up typo so that it also works (with a different url). I have 4 URLs running -- let''s call them foo.com, bar.com, typo.com and php.typo.com I am starting lighttpd by going into the directory where my foo.com app is and typing either ruby script/server or script/server -e production -- either way the results I get are: foo.com works (rails app) bar.com works (non rails app .. just html but will have a rails app later) php.typo.com works (phpmyadmin for mysql) typo.com shows me foo.com with broken images instead of typo Not sure why that''s happening.. can somebody help? I am posting my lighttpd.conf file but I''m not sure if this is where my error is. FWIW I have already set up a database called typo using php.typo.com. [code] server.modules = ( "mod_rewrite", "mod_redirect", "mod_proxy", "mod_accesslog", "mod_access", "mod_fastcgi", "mod_compress", "mod_accesslog" ) server.document-root = "/var/www" server.bind = "0.0.0.0" server.port = 80 server.pid-file = "/var/run/lighttpd.pid" server.tag = "lighttpd" accesslog.filename = "/var/log/lighttpd.access.log" server.errorlog = "/var/log/lighttpd.error.log" server.indexfiles = ( "index.php", "index.html", "index.htm", "default. htm" ) url.access-deny = ( "~", ".inc" ) $HTTP["host"] == "php.typo.com" { accesslog.filename = "/var/log/lighttpd.php.access.log" server.document-root = "/var/www/phpmyadmin" server.indexfiles = ( "index.php", "index.html", "index.htm", "def ault.htm" ) fastcgi.server = ( ".php" => ( "localhost" => ( "socket" => "/tmp/php4-fcgi.socket", "bin-path" => "/usr/bin/php4-cgi -c /etc/php4/cgi/php.ini", "bin-environment" => ( "PHP_FCGI_CHILDREN" => "32", "PHP_FCGI_MAX_REQUESTS" => "5000" ) ) ) ) } # Rails site, I want this on www or no www $HTTP["host"] == "bar.com" { server.port = 80 server.document-root = "/var/www/bar/public" server.error-handler-404 = "/dispatch.fcgi" server.indexfiles = ( "index.php", "index.html", "index.htm", "defaul t.htm" ) url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "log/fcgi.socket", "bin-environment" => ( "RAILS_ENV" => "development" ), "bin-path" => "public/dispatch.fcgi", # "max-load-per-proc" => 4, "min-procs" => 1, "max-procs" => 4, # "idle-timeout" => 60 ) ) ) } # Railfood vhost $HTTP["host"] == "foo.com" { server.port = 80 server.document-root = "/var/www/foo/public" server.error-handler-404 = "/dispatch.fcgi" server.indexfiles = ( "index.php", "index.html", "index.htm", "defaul t.htm" ) url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "log/fcgi.socket", "bin-environment" => ( "RAILS_ENV" => "development" ), "bin-path" => "public/dispatch.fcgi", # "max-load-per-proc" => 4, "min-procs" => 1, "max-procs" => 4 # "idle-timeout" => 60 ) ) ) } $HTTP["host"] == "typo.com" { server.port = 80 server.document-root = "/var/www/typo/public" server.error-handler-404 = "/dispatch.fcgi" server.indexfiles = ( "index.php", "index.html", "index.htm", "defaul t.htm" ) url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) fastcgi.server = ( ".fcgi" => ( "localhost" => ( "socket" => "log/fcgi.socket", "bin-environment" => ( "RAILS_ENV" => "production" ), "bin-path" => "public/dispatch.fcgi", # "max-load-per-proc" => 4, "min-procs" => 1, "max-procs" => 4 # "idle-timeout" => 60 ) ) ) } mimetype.assign = ( ".pdf" => "application/pdf", ".css" => "text/css", ".gif" => "image/gif", ".htm" => "text/html", ".html" => "text/html", ".jpeg" => "image/jpeg", ".jpg" => "image/jpeg", ".js" => "text/javascript", ".png" => "image/png", ".sig" => "application/pgp-signature", ".spl" => "application/futuresplash", ".class" => "application/octet-stream", ".ps" => "application/postscript", ".torrent" => "application/x-bittorrent", ".dvi" => "application/x-dvi", ".gz" => "application/x-gzip", ".pac" => "application/x-ns-proxy-autoconfig", ".swf" => "application/x-shockwave-flash", ".txt" => "text/plain" ) [/code] -- Posted via ruby-forum.com.
anyone? -- Posted via ruby-forum.com.
Ezra Zygmuntowicz
2006-Feb-16 18:02 UTC
[Rails] Re: Multiple Rails app on the same server? [bump]
On Feb 16, 2006, at 8:26 AM, Vince W. wrote:> anyone? > > -- > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > lists.rubyonrails.org/mailman/listinfo/rails >Vince- I am reading this from the mailing list so i don''t see your initial question. What platform is the server and what webserver are you using? Lighttpd or apache? I''ll give you my configs if you explain your details a bit more. Cheers- -Ezra Zygmuntowicz Yakima Herald-Republic WebMaster yakimaherald.com 509-577-7732 ezra@yakima-herald.com
Vince W.
2006-Feb-16 18:29 UTC
[Rails] Re: Re: Multiple Rails app on the same server? [bump]
> > Vince- > > I am reading this from the mailing list so i don''t see your initial > question. What platform is the server and what webserver are you > using? Lighttpd or apache? I''ll give you my configs if you explain > your details a bit more. >Hi Ezra, I replied to you by email and will post a solution back to the board once it''s solved. Thanks for your help! Vince -- Posted via ruby-forum.com.
Neil Dugan
2006-Feb-16 22:47 UTC
[Rails] Re: Multiple Rails app on the same server? [bump]
Vince W. wrote:> anyone? >I have two different RoR apps & two ordinary web-sites on the one lighttpd server. Works no problem :) Plus two encrypted sites (one RoR) on another lighttpd server.
Vince W.
2006-Feb-16 23:17 UTC
[Rails] Re: Re: Multiple Rails app on the same server? [bump]
Neil Dugan wrote:> I have two different RoR apps & two ordinary web-sites on the one > lighttpd server. > Works no problem :) > > Plus two encrypted sites (one RoR) on another lighttpd server.Yep, got this working with Ezra''s help. Will post the solution if anyone is interested but it boiled down to some corrections in lighttpd.conf -- Posted via ruby-forum.com.
>if anyone is interestedI am working on one app right now so at the moment it isn''t important. But in the future it will and probably for many others. So please share. -- Posted via ruby-forum.com.
Stephen Veit
2006-Feb-17 00:11 UTC
[Rails] Re: Re: Multiple Rails app on the same server? [bump]
On 2/16/06, Peter <test@test.be> wrote:> >if anyone is interested > > I am working on one app right now so at the moment it isn''t important. > But in the future it will and probably for many others. > > So please share. >I am also interested in this solution. I need to run two applications on the same port with the same domain name.
Vince W.
2006-Feb-17 02:52 UTC
[Rails] Re: Re: Re: Multiple Rails app on the same server? [bump]
> I am also interested in this solution. I need to run two applications > on the same port with the same domain name.This is actually to run two apps on two domains on the same machine. I suppose this could be modified for your purposes but you could also look at the solution here: blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps Anyway, here is the lighttpd.conf file that Ezra so graciously helped me with: [code] server.modules = ( "mod_rewrite", "mod_redirect", "mod_access", "mod_fastcgi", "mod_compress", "mod_accesslog") server.document-root = "/var/www" server.bind = "0.0.0.0" server.port = 80 server.pid-file = "/tmp/main_lighttpd.pid" server.tag = "lighttpd" accesslog.filename = "/var/log/lighttpd.access.log" server.errorlog = "/var/log/lighttpd.error.log" server.indexfiles = ("index.php","index.html","index.htm","default.htm") #url.access-deny = ("~", ".inc") $HTTP["host"] =~ "(^|\.)foo.com" { server.document-root = "/var/www/foo/public/" server.error-handler-404 = "/dispatch.fcgi" server.indexfiles = ("dispatch.fcgi") fastcgi.server = (".fcgi" => ("localhost" => ("socket" => "/tmp/foo.socket", "min-procs" => 2, "max-procs" => 2, "bin-path" => "/var/www/foo/public/dispatch.fcgi", "bin-environment" => ("RAILS_ENV" => "development") ))) } $HTTP["host"] =~ "(^|\.)typo\.com" { server.document-root = "/var/www/typo/public/" server.error-handler-404 = "/dispatch.fcgi" server.indexfiles = ("dispatch.fcgi") fastcgi.server = (".fcgi" => ("localhost" => ("socket" => "/tmp/typo.socket", "min-procs" => 2, "max-procs" => 2, "bin-path" => "/var/www/typo/public/dispatch.fcgi", "bin-environment" => ("RAILS_ENV" => "production") ))) } mimetype.assign = ( ".pdf" => "application/pdf", ".sig" => "application/pgp-signature", ".spl" => "application/futuresplash", snip.. ) [/code] -- Posted via ruby-forum.com.
Vince W. wrote:>>I am also interested in this solution. I need to run two applications >>on the same port with the same domain name. >How where you thinking of deciding on what app to run? I use subdomains like http://<app>.<domain>> > This is actually to run two apps on two domains on the same machine. I > suppose this could be modified for your purposes but you could also look > at the solution here: > > blog.lighttpd.net/articles/2005/11/23/lighttpd-1-4-8-and-multiple-rails-apps > > Anyway, here is the lighttpd.conf file that Ezra so graciously helped me > with: > > [code] > server.modules = ( > "mod_rewrite", > "mod_redirect", > "mod_access", > "mod_fastcgi", > "mod_compress", > "mod_accesslog") > > server.document-root = "/var/www" > server.bind = "0.0.0.0" > server.port = 80 > server.pid-file = "/tmp/main_lighttpd.pid" > server.tag = "lighttpd" > accesslog.filename = "/var/log/lighttpd.access.log" > server.errorlog = "/var/log/lighttpd.error.log" > server.indexfiles = > ("index.php","index.html","index.htm","default.htm") > #url.access-deny = ("~", ".inc") > > $HTTP["host"] =~ "(^|\.)foo.com" { > server.document-root = "/var/www/foo/public/" > server.error-handler-404 = "/dispatch.fcgi" > server.indexfiles = ("dispatch.fcgi") > fastcgi.server = (".fcgi" => > ("localhost" => > ("socket" => "/tmp/foo.socket", > "min-procs" => 2, > "max-procs" => 2, > "bin-path" => "/var/www/foo/public/dispatch.fcgi", > "bin-environment" => ("RAILS_ENV" => "development") > ))) > } > > $HTTP["host"] =~ "(^|\.)typo\.com" { > server.document-root = "/var/www/typo/public/" > server.error-handler-404 = "/dispatch.fcgi" > server.indexfiles = ("dispatch.fcgi") > fastcgi.server = (".fcgi" => > ("localhost" => > ("socket" => "/tmp/typo.socket", > "min-procs" => 2, > "max-procs" => 2, > "bin-path" => "/var/www/typo/public/dispatch.fcgi", > "bin-environment" => ("RAILS_ENV" => "production") > ))) > } > > mimetype.assign = ( > ".pdf" => "application/pdf", > ".sig" => "application/pgp-signature", > ".spl" => "application/futuresplash", > > snip.. > ) > [/code] >
Michael Trier
2006-Feb-17 03:08 UTC
[Rails] Re: Re: Re: Multiple Rails app on the same server? [bump]
I am doing just that. The following shows two separate apps as subdirectories off of a single domain and then another one that''s a subdomain so you can see how it all works. I''ve not included all the other stuff, just the pertinent parts. I also had to add the following line into my production.rb file in the config/environments directory for each app: ActionController::AbstractRequest.relative_url_root = "/app1" $HTTP["host"] == "railsconsulting.com" { $HTTP["url"] =~ "^/app1" { var.appname = "app1" server.document-root = "/var/www/" + var.appname + "/current/public" alias.url = ( "/app1" => "/var/www/" + var.appname + "/current/public" ) server.error-handler-404 = "/app1/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ( var.appname => ( "min-procs" => 2, "max-procs" => 2, "socket" => "/tmp/" + var.appname + ".fcgi.socket", "bin-path" => "/var/www/" + var.appname + "/current/public/dispatch.fc gi", "bin-environment" => ( "RAILS_ENV" => "production" ), ) ) ) } $HTTP["url"] =~ "^/app2" { var.appname = "app2" server.document-root = "/var/www/" + var.appname + "/current/public" alias.url = ( "/app2" => "/var/www/" + var.appname + "/current/public" ) server.error-handler-404 = "/app2/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ( var.appname => ( "min-procs" => 2, "max-procs" => 2, "socket" => "/tmp/" + var.appname + ".fcgi.socket", "bin-path" => "/var/www/" + var.appname + "/current/public/dispatch.fc gi", "bin-environment" => ( "RAILS_ENV" => "production" ), ) ) ) } } ## BLOG $HTTP["host"] == "blog.railsconsulting.com" { var.appname = "typo" server.document-root = "/var/www/" + var.appname + "/public" fastcgi.server = ( ".fcgi" => ( var.appname => ( "min-procs" => 2, "max-procs" => 2, "socket" => "/tmp/" + var.appname + ".fcgi.socket", "bin-path" => "/var/www/" + var.appname + "/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "production" ) ) ) ) }
Stephen Veit
2006-Feb-17 20:46 UTC
[Rails] Re: Re: Re: Multiple Rails app on the same server? [bump]
On 2/16/06, Michael Trier <mtrier@gmail.com> wrote:> I am doing just that. The following shows two separate apps as > subdirectories off of a single domain and then another one that''s a > subdomain so you can see how it all works. I''ve not included all the > other stuff, just the pertinent parts. I also had to add the > following line into my production.rb file in the config/environments > directory for each app: > > ActionController::AbstractRequest.relative_url_root = "/app1" > > > $HTTP["host"] == "railsconsulting.com" { > $HTTP["url"] =~ "^/app1" { > var.appname = "app1" > server.document-root = "/var/www/" + var.appname + "/current/public" > alias.url = ( "/app1" => "/var/www/" + var.appname + "/current/public" ) > server.error-handler-404 = "/app1/dispatch.fcgi" > fastcgi.server = ( ".fcgi" => > ( var.appname => > ( "min-procs" => 2, > "max-procs" => 2, > "socket" => "/tmp/" + var.appname + ".fcgi.socket", > "bin-path" => "/var/www/" + var.appname + "/current/public/dispatch.fc > gi", > "bin-environment" => ( "RAILS_ENV" => "production" ), > ) > ) > ) > } > $HTTP["url"] =~ "^/app2" { > var.appname = "app2" > server.document-root = "/var/www/" + var.appname + "/current/public" > alias.url = ( "/app2" => "/var/www/" + var.appname + "/current/public" ) > server.error-handler-404 = "/app2/dispatch.fcgi" > fastcgi.server = ( ".fcgi" => > ( var.appname => > ( "min-procs" => 2, > "max-procs" => 2, > "socket" => "/tmp/" + var.appname + ".fcgi.socket", > "bin-path" => "/var/www/" + var.appname + "/current/public/dispatch.fc > gi", > "bin-environment" => ( "RAILS_ENV" => "production" ), > ) > ) > ) > } > } > > ## BLOG > $HTTP["host"] == "blog.railsconsulting.com" { > var.appname = "typo" > server.document-root = "/var/www/" + var.appname + "/public" > fastcgi.server = ( ".fcgi" => > ( var.appname => > ( "min-procs" => 2, > "max-procs" => 2, > "socket" => "/tmp/" + var.appname + ".fcgi.socket", > "bin-path" => "/var/www/" + var.appname + "/public/dispatch.fcgi", > "bin-environment" => ( "RAILS_ENV" => "production" ) > ) > ) > ) > }Thanks! I missed the $HTTP["url"] conditional.