Hi I am running ruby 1.8.4 and rails 1.0.0 with Apache 2. I made a simple rails application called demo and also created a controller called say and an action called hello which is working fine using webrick. To run it under Apache I created a symlink demo1 which is linked to the demo/public directory. If I run it using www.example.com/demo1 then I get the "Rails- Welcome Aboard" page. However, the problem starts when I try to access www.example.com/demo1/say/hello. It gives, "Application error Rails application failed to start properly" When I do a tail -f error_log then I get "Premature end of script headers: dispatch.cgi". Since I spent almost a day trying to work out the problem and visiting several forums where most of the people advise on checking the permission of log files and shebang in dispatch.cgi which I already checked but now I am not sure what is wrong. I would be really grateful if you could tell me what I might be doing wrong. Please let me know if you want to have a look at my dispatch.cgi or any other file. Thanks a lot in advance. -- Posted via http://www.ruby-forum.com/.
Hi I am running ruby 1.8.4 and rails 1.0.0 with Apache 2. I made a simple rails application called demo and also created a controller called say and an action called hello which is working fine using webrick. To run it under Apache I created a symlink demo1 which is linked to the demo/public directory. If I run it using www.example.com/demo1 then I get the "Rails- Welcome Aboard" page. However, the problem starts when I try to access www.example.com/demo1/say/hello. It gives, "Application error: Rails application failed to start properly" When I do a tail -f error_log then I get "Premature end of script headers: dispatch.cgi". Since I spent almost a day trying to work out the problem and visiting several forums where most of the people advise on checking the permission of log files and shebang in dispatch.cgi which I already checked but now I am not sure what is wrong. I would be really grateful if anyone could tell me what I might be doing wrong. Thanks a lot in advance. -- View this message in context: http://www.nabble.com/Premature-end-of-script-headers%3A-dispatch.cgi-t1320968.html#a3523957 Sent from the RubyOnRails Users forum at Nabble.com.
Try to run dispatch.cgi from the command line. Also, make sure it''s executable. -- -- Tom Mornini On Mar 21, 2006, at 4:05 PM, Nas wrote:> Hi > > I am running ruby 1.8.4 and rails 1.0.0 with Apache 2. I made a simple > rails application called demo and also created a controller called say > and an action called hello which is working fine using webrick. To run > it under Apache I created a symlink demo1 which is linked to the > demo/public directory. If I run it using www.example.com/demo1 then I > get the "Rails- Welcome Aboard" page. However, the problem starts > when I > try to access www.example.com/demo1/say/hello. It gives, "Application > error > Rails application failed to start properly" When I do a tail -f > error_log then I get "Premature end of script headers: dispatch.cgi". > Since I spent almost a day trying to work out the problem and visiting > several forums where most of the people advise on checking the > permission of log files and shebang in dispatch.cgi which I already > checked but now I am not sure what is wrong. > > I would be really grateful if you could tell me what I might be doing > wrong. > > Please let me know if you want to have a look at my dispatch.cgi or > any > other file. > > Thanks a lot in advance. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Tom, Thanks for the reply. I tried running it from the command line (./dispatch.cgi) and I get a "500 internal Server Error" Any ideas why I am getting this? Thanks Tom Mornini wrote:> Try to run dispatch.cgi from the command line. > > Also, make sure it''s executable. > > -- > -- Tom Mornini-- Posted via http://www.ruby-forum.com/.
Tom Mornini
2006-Mar-22 08:44 UTC
[Rails] Re: Premature end of script headers: dispatch.cgi
On Mar 21, 2006, at 11:42 PM, Nas wrote:> Thanks for the reply. I tried running it from the command line > (./dispatch.cgi) and I get a "500 internal Server Error" > > Any ideas why I am getting this?That''s actually a good sign(!) In my experience, that means everything is basically OK, and the error is generated because there is no request on STDIN (when you run it via the command line). 1) Is it really dispatch.cgi or is it dispatch.fcgi? 2) This may have to do with web server config, since it appears (in a rather twisted fashion) that all else is OK. -- -- Tom Mornini
Tom Mornini wrote:> On Mar 21, 2006, at 11:42 PM, Nas wrote: > >> Thanks for the reply. I tried running it from the command line >> (./dispatch.cgi) and I get a "500 internal Server Error" >> >> Any ideas why I am getting this? > > That''s actually a good sign(!) > > In my experience, that means everything is basically OK, > and the error is generated because there is no request > on STDIN (when you run it via the command line). > > 1) Is it really dispatch.cgi or is it dispatch.fcgi? > 2) This may have to do with web server config, since > it appears (in a rather twisted fashion) that all > else is OK. > > -- > -- Tom MorniniYes, it is dispatch.cgi, so what might be wrong with the server config? I have copied a portion of my config file below, please let me know if you find something wrong in there. <VirtualHost ***********:80> ServerName ********:80 ServerAlias www.********* UseCanonicalName Off ServerAdmin "*******@***.com" DocumentRoot /var/www/vhosts/*******/httpdocs CustomLog /var/www/vhosts/*******/statistics/logs/access_log ErrorLog /var/www/vhosts/*******/statistics/logs/error_log ScriptAlias /cgi-bin/ /var/www/vhosts/*******/cgi-bin/ <IfModule mod_ssl.c> SSLEngine off </IfModule> <Directory /var/www/vhosts/*******/httpdocs> <IfModule mod_perl.c> <Files ~ (\.pl$)> SetHandler perl-script PerlHandler ModPerl::Registry Options ExecCGI allow from all PerlSendHeader On </Files> </IfModule> <IfModule sapi_apache2.c> php_admin_flag engine on php_admin_value open_basedir "/var/www/vhosts/*****/httpdocs:/tmp" </IfModule> <IfModule mod_php5.c> php_admin_flag engine on php_admin_value open_basedir "/var/www/vhosts/******/httpdocs:/tmp" </IfModule> <IfModule mod_python.c> <Files ~ (\.py$)> SetHandler python-program PythonHandler mod_python.cgihandler </Files> </IfModule> </Directory> <Directory /var/www/vhosts/*******/httpdocs/demo/public/> Options ExecCGI FollowSymLinks AddHandler cgi-script .cgi AllowOverride all Allow from all Order allow,deny </Directory> <Directory /var/www/vhosts/********/web_users> <IfModule sapi_apache2.c> AddType text/plain .php .php4 .php3 .phtml php_admin_flag engine off </IfModule> <IfModule mod_php5.c> AddType text/plain .php .php5 .php4 .php3 .phtml php_admin_flag engine off </IfModule> </Directory> Alias "/error_docs" "/var/www/vhosts/********/error_docs" ErrorDocument 400 /error_docs/bad_request.html ErrorDocument 401 /error_docs/unauthorized.html ErrorDocument 403 /error_docs/forbidden.html ErrorDocument 404 /error_docs/not_found.html ErrorDocument 500 /error_docs/internal_server_error.html AddType application/x-httpd-eruby .rhtml </VirtualHost> Thanks in advance -- Posted via http://www.ruby-forum.com/.
Tom Mornini
2006-Mar-22 10:18 UTC
[Rails] Re: Re: Premature end of script headers: dispatch.cgi
I know *nothing* about Rail via CGI on Apache. One thing I notice right away, however, is that there doesn''t appear to be anything in your config that would direct Rails URLs to dispatch.cgi... -- -- Tom Mornini On Mar 22, 2006, at 1:26 AM, Nas wrote:> Tom Mornini wrote: >> On Mar 21, 2006, at 11:42 PM, Nas wrote: >> >>> Thanks for the reply. I tried running it from the command line >>> (./dispatch.cgi) and I get a "500 internal Server Error" >>> >>> Any ideas why I am getting this? >> >> That''s actually a good sign(!) >> >> In my experience, that means everything is basically OK, >> and the error is generated because there is no request >> on STDIN (when you run it via the command line). >> >> 1) Is it really dispatch.cgi or is it dispatch.fcgi? >> 2) This may have to do with web server config, since >> it appears (in a rather twisted fashion) that all >> else is OK. >> >> -- >> -- Tom Mornini > > Yes, it is dispatch.cgi, so what might be wrong with the server > config? > > I have copied a portion of my config file below, please let me know if > you find something wrong in there. > > > > <VirtualHost ***********:80> > ServerName ********:80 > ServerAlias www.********* > UseCanonicalName Off > ServerAdmin "*******@***.com" > DocumentRoot /var/www/vhosts/*******/httpdocs > CustomLog /var/www/vhosts/*******/statistics/logs/access_log > ErrorLog /var/www/vhosts/*******/statistics/logs/error_log > > ScriptAlias /cgi-bin/ /var/www/vhosts/*******/cgi-bin/ > <IfModule mod_ssl.c> > SSLEngine off > </IfModule> > <Directory /var/www/vhosts/*******/httpdocs> > <IfModule mod_perl.c> > <Files ~ (\.pl$)> > SetHandler perl-script > > PerlHandler > ModPerl::Registry > Options ExecCGI > allow from all > PerlSendHeader On > </Files> > </IfModule> > <IfModule sapi_apache2.c> > php_admin_flag engine on > php_admin_value open_basedir > "/var/www/vhosts/*****/httpdocs:/tmp" > </IfModule> > <IfModule mod_php5.c> > php_admin_flag engine on > php_admin_value open_basedir > "/var/www/vhosts/******/httpdocs:/tmp" > </IfModule> > <IfModule mod_python.c> > <Files ~ (\.py$)> > SetHandler python-program > PythonHandler mod_python.cgihandler > </Files> > </IfModule> > </Directory> > <Directory /var/www/vhosts/*******/httpdocs/demo/public/> > Options ExecCGI FollowSymLinks > AddHandler cgi-script .cgi > AllowOverride all > Allow from all > Order allow,deny > </Directory> > <Directory /var/www/vhosts/********/web_users> > <IfModule sapi_apache2.c> > AddType text/plain .php .php4 .php3 .phtml > php_admin_flag engine off > </IfModule> > <IfModule mod_php5.c> > AddType text/plain .php .php5 .php4 .php3 .phtml > php_admin_flag engine off > </IfModule> > </Directory> > Alias "/error_docs" "/var/www/vhosts/********/error_docs" > ErrorDocument 400 /error_docs/bad_request.html > ErrorDocument 401 /error_docs/unauthorized.html > ErrorDocument 403 /error_docs/forbidden.html > ErrorDocument 404 /error_docs/not_found.html > ErrorDocument 500 /error_docs/internal_server_error.html > AddType application/x-httpd-eruby .rhtml > </VirtualHost> > > > Thanks in advance > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Nas
2006-Mar-22 11:16 UTC
[Rails] Re: Re: Re: Premature end of script headers: dispatch.cgi
Tom Mornini wrote:> I know *nothing* about Rail via CGI on Apache. > > One thing I notice right away, however, is that > there doesn''t appear to be anything in your config > that would direct Rails URLs to dispatch.cgi... > > -- > -- Tom MorniniAny idea, how can I do that? -- Posted via http://www.ruby-forum.com/.
Nas
2006-Mar-23 15:37 UTC
[Rails] Re: Re: Re: Premature end of script headers: dispatch.cgi
Nas wrote:> Tom Mornini wrote: >> I know *nothing* about Rail via CGI on Apache. >> >> One thing I notice right away, however, is that >> there doesn''t appear to be anything in your config >> that would direct Rails URLs to dispatch.cgi... >> >> -- >> -- Tom Mornini > > Any idea, how can I do that?Now I am using fcgi and its working fine. I think thats the reason people advise to use fast cgi. Anyway, thanks for your replies Tom. Nas -- Posted via http://www.ruby-forum.com/.