Bing Tan
2006-Aug-18 12:49 UTC
[Rails] Lighttpd Conf Help - Multiple Domains Multiple Apps
Hi Guys, I hope someone can help me out. I am trying to configure two applications to run on lighttpd and each app will have its own domain. My machine is running on Fedora. When I run my lighttpd with the following conf file, I get no error but when I check out my app, it dishes out a 404 error- the 404 being served isn''t the 404 inside the railsapp/public folder. Do hope someone can help me out what''s wrong with my conf. Here it is: server.bind = "0.0.0.0" server.port = 8282 server.modules = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi", "mod_compress", "mod_expire" ) server.pid-file = "/var/run/lighttpd.pid" url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) #commenting the line below gives out an error that says: "a default document-root has to be set" server.document-root = "/path/to/rails/app1/public/" compress.filetype = ( "text/plain", "text/html", "text/css", "text/javascript" ) #I temporarily commented out the compress and expire methods #compress.cache-dir = CWD + "/tmp/cache" #expire.url = ( "/favicon.ico" => "access 3 days", # "/images/" => "access 3 days", # "/stylesheets/" => "access 3 days", # "/javascripts/" => "access 3 days" ) # Change *-procs to 2 if you need to use Upload Progress or other tasks that # *need* to execute a second request while the first is still pending. mimetype.assign = ( ".css" => "text/css", ".gif" => "image/gif", ".htm" => "text/html", ".html" => "text/html", ".jpeg" => "image/jpeg", ".jpg" => "image/jpeg", ".js" => "text/javascript", ".png" => "image/png", ".swf" => "application/x-shockwave-flash", ".txt" => "text/plain" ) # Making sure file uploads above 64k always work when using IE or Safari # For more information, see http://trac.lighttpd.net/trac/ticket/360 $HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" { #server.max-keep-alive-requests = 0 server.max-keep-alive-requests = 128 server.max-keep-alive-idle = 30 server.max-read-idle = 60 server.max-write-idle = 360 server.max-fds = 2048 } $HTTP["host"] =~ "(^|\.)mysite1\.com$" { server.document-root = "/path/to/rails/app1" #notice the public folder wasn''t stated here server.errorlog = "/var/log/lighttpd/mysite1.com/error.log" accesslog.filename = "/var/log/lighttpd/mysite1.com/lighttpd.access.log" compress.cache-dir = "/path/to/rails/app1/tmp/cache" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ( "localhost" => ( "min-procs" => 1, "max-procs" => 1, "socket" => "/path/to/rails/app1/tmp/sockets/fcgi.socket", "bin-path" => "/path/to/rails/app1/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "development" ) ) ) ) } $HTTP["host"] =~ "(^|\.)mysite2\.com$" { server.document-root = "/path/to/rails/app2" server.errorlog = "/var/log/lighttpd/mysite2.com/error.log" accesslog.filename = "/var/log/lighttpd/mysite2.com/lighttpd.access.log" server.error-handler-404 = "/e404.html" #compress.cache-dir = "/tmp/cache" #fastcgi.server = ( ".fcgi" => ( "localhost" => ( # "min-procs" => 1, # "max-procs" => 1, # "socket" => "/path/to/rails/app2/tmp/sockets/fcgi.socket", # "bin-path" => "/path/to/rails/app2/public/dispatch.fcgi", # "bin-environment" => ( "RAILS_ENV" => "development" ) #) ) ) } -- Posted via http://www.ruby-forum.com/.
www-data
2006-Aug-18 18:14 UTC
[Rails] Re: Lighttpd Conf Help - Multiple Domains Multiple Apps
Hi Bing, Obscuring the file / directory paths is making it difficult for me to help you out with your config (if you are not obscuring your directories - then I suggest you make certain they are all right). But what I can do is suggest that you use mod_simple_vhost --- you can grab my conf file and learn a bit about it at http://www.forthecode.com/user/comment/22 This config works fine for me - you can just ignore the stuff about being behind Apache2 (and just set the port lighttpd listens on to the correct one). Regards, Charles Bing Tan wrote:> Hi Guys, > > I hope someone can help me out. I am trying to configure two > applications to run on lighttpd and each app will have its own domain. > My machine is running on Fedora. When I run my lighttpd with the > following conf file, I get no error but when I check out my app, it > dishes out a 404 error- the 404 being served isn''t the 404 inside the > railsapp/public folder. > > Do hope someone can help me out what''s wrong with my conf. Here it is: > > > server.bind = "0.0.0.0" > server.port = 8282 > server.modules = ( "mod_rewrite", "mod_accesslog", > "mod_fastcgi", "mod_compress", "mod_expire" ) > server.pid-file = "/var/run/lighttpd.pid" > > url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => > "$1.html" ) > > #commenting the line below gives out an error that says: "a default > document-root has to be set" > server.document-root = "/path/to/rails/app1/public/" > > compress.filetype = ( "text/plain", "text/html", "text/css", > "text/javascript" ) > #I temporarily commented out the compress and expire methods > #compress.cache-dir = CWD + "/tmp/cache" > #expire.url = ( "/favicon.ico" => "access 3 days", > # "/images/" => "access 3 days", > # "/stylesheets/" => "access 3 days", > # "/javascripts/" => "access 3 days" ) > > # Change *-procs to 2 if you need to use Upload Progress or other tasks > that > # *need* to execute a second request while the first is still pending. > > mimetype.assign = ( > ".css" => "text/css", > ".gif" => "image/gif", > ".htm" => "text/html", > ".html" => "text/html", > ".jpeg" => "image/jpeg", > ".jpg" => "image/jpeg", > ".js" => "text/javascript", > ".png" => "image/png", > ".swf" => "application/x-shockwave-flash", > ".txt" => "text/plain" > ) > > # Making sure file uploads above 64k always work when using IE or Safari > # For more information, see http://trac.lighttpd.net/trac/ticket/360 > $HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" { > #server.max-keep-alive-requests = 0 > server.max-keep-alive-requests = 128 > server.max-keep-alive-idle = 30 > server.max-read-idle = 60 > server.max-write-idle = 360 > server.max-fds = 2048 > } > > $HTTP["host"] =~ "(^|\.)mysite1\.com$" { > server.document-root = "/path/to/rails/app1" #notice the public folder > wasn''t stated here > server.errorlog = "/var/log/lighttpd/mysite1.com/error.log" > accesslog.filename = "/var/log/lighttpd/mysite1.com/lighttpd.access.log" > compress.cache-dir = "/path/to/rails/app1/tmp/cache" > server.error-handler-404 = "/dispatch.fcgi" > fastcgi.server = ( ".fcgi" => ( "localhost" => ( > "min-procs" => 1, > "max-procs" => 1, > "socket" => "/path/to/rails/app1/tmp/sockets/fcgi.socket", > "bin-path" => "/path/to/rails/app1/public/dispatch.fcgi", > "bin-environment" => ( "RAILS_ENV" => "development" ) > ) ) ) > } > $HTTP["host"] =~ "(^|\.)mysite2\.com$" { > server.document-root = "/path/to/rails/app2" > server.errorlog = "/var/log/lighttpd/mysite2.com/error.log" > accesslog.filename = "/var/log/lighttpd/mysite2.com/lighttpd.access.log" > server.error-handler-404 = "/e404.html" > #compress.cache-dir = "/tmp/cache" > #fastcgi.server = ( ".fcgi" => ( "localhost" => ( > # "min-procs" => 1, > # "max-procs" => 1, > # "socket" => "/path/to/rails/app2/tmp/sockets/fcgi.socket", > # "bin-path" => "/path/to/rails/app2/public/dispatch.fcgi", > # "bin-environment" => ( "RAILS_ENV" => "development" ) > #) ) ) > }-- Posted via http://www.ruby-forum.com/.
Bing Tan
2006-Aug-22 10:31 UTC
[Rails] Re: Lighttpd Conf Help - Multiple Domains Multiple Apps
Hi Charles, I tried the vhost and it''s still not working. Here is my conf again, hopefully this is much clearer. We played around with and currently with this config I''m still getting the 404.html. # Default configuration file for the lighttpd web server # Start using ./script/server lighttpd server.bind = "0.0.0.0" server.port = 8282 server.modules = ( "mod_rewrite", "mod_accesslog", "mod_fastcgi") server.document-root = "/var/www/vhosts/domain1.com/httpdocs/railsapp1/public/" server.errorlog = "/var/log/lighttpd/lighttpd.error.log" accesslog.filename = "/var/log/lighttpd/lighttpd.access.log" url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" ) mimetype.assign = ( ".css" => "text/css", ".gif" => "image/gif", ".htm" => "text/html", ".html" => "text/html", ".jpeg" => "image/jpeg", ".jpg" => "image/jpeg", ".js" => "text/javascript", ".png" => "image/png", ".swf" => "application/x-shockwave-flash", ".txt" => "text/plain" ) # Making sure file uploads above 64k always work when using IE or Safari # For more information, see http://trac.lighttpd.net/trac/ticket/360 $HTTP["useragent"] =~ "^(.*MSIE.*)|(.*AppleWebKit.*)$" { #server.max-keep-alive-requests = 0 server.max-keep-alive-requests = 128 server.max-keep-alive-idle = 30 server.max-read-idle = 60 server.max-write-idle = 360 server.max-fds = 2048 } $HTTP["host"] =~ "(^|\.)domain1\.com$" { server.document-root = "/var/www/vhosts/domain1.com/httpdocs/railsapp1/public/" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ( "localhost" => ( "min-procs" => 1, "max-procs" => 1, "socket" => "/var/www/vhosts/domain1.com/httpdocs/railsapp1/tmp/sockets/fcgi.socket", "bin-path" => "/var/www/vhosts/domain1.com/httpdocs/railsapp1/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "development" ) ) ) ) } $HTTP["host"] =~ "(^|\.)domain2\.com$" { server.document-root = "/var/www/vhosts/domain2.com/httpdocs/railsapp2/public/" server.error-handler-404 = "/dispatch.fcgi" fastcgi.server = ( ".fcgi" => ( "localhost" => ( "min-procs" => 1, "max-procs" => 1, "socket" => "/var/www/vhosts/domain1.com/httpdocs/railsapp1/tmp/sockets/fcgi.socket", "bin-path" => "/var/www/vhosts/domain1.com/httpdocs/railsapp1/public/dispatch.fcgi", "bin-environment" => ( "RAILS_ENV" => "development" ) ) ) ) } Bing -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Charles Abbott
2006-Aug-22 22:59 UTC
[Rails] Re: Lighttpd Conf Help - Multiple Domains Multiple Apps
Bing, add these directives to your lighttpd.conf: debug.log-file-not-found = "enable" debug.log-request-header = "enable" debug.log-response-header = "enable" debug.log-request-handling = "enable" then restart lighttpd. Run this from the command line of your server: tail -f /var/log/lighttpd/lighttpd.access.log Then try to go to your domain and watch the output in your ssh session. Watch what lighttpd does with your request. Make certain that when the "File Not Found" shows up in your access log that lighttpd properly hands the problem over to dispatch.fcgi (the path to dispatch.fcgi must be correct as well). Additionally I don''t see the server.groupname or server.username set in your config - I''m not certain if that is causing your problem, but set those if they need to be (I needed them). I was able to figure out my problems using the debug. directives - so try those first. Hope that helps, Charles -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---