Error Reading Data From Fastcgi Server Django
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Django and fcgi and mod_fcgid errors up vote 1 down vote favorite Ok I'm exhausted with this problem on my shared server at Bluehost and I haven't been able to find any ideas. I've uploaded my app and everything appears to be working fine except for one thing, the photo uploader that I'm using (which is the core of the site). I'm using the stdimage2 Django app (a fork of stdimage) and it worked fine on the development server (Ubuntu 10.04). But it's having major problems at the moment and I'm looking for any possible ideas or inklings of things that I'm missing. Here's the errors that are being printed out (this is with four pictures being sent as separate requests one after the other by the uploader): [Wed Dec 21 09:47:03 2011] [warn] [client 128.187.97.6] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://gallery.fernstenfamily.com/backend/upload/1/ [Wed Dec 21 09:47:03 2011] [error] [client 128.187.97.6] Premature end of script headers: mySite.fcgi, referer: http://gallery.fernstenfamily.com/backend/upload/1/ [Wed Dec 21 09:47:03 2011] [warn] RewriteCond: NoCase option for non-regex pattern '-f' is not supported and will be ignored. [Wed Dec 21 09:47:03 2011] [warn] [client 128.187.97.6] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://gallery.fernstenfamily.com/backend/upload/1/ [Wed Dec 21 09:47:03 2011] [error] [client 128.187.97.6] Premature end of script headers: mySite.fcgi, referer: http://gallery.fernstenfamily.com/backend/upload/1/ [Wed Dec 21 09:47:04 2011] [warn] [client 128.187.97.6] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://gallery.fernstenfamily.com/backend/upload/1/ [Wed Dec 21 09:47:04 2011] [error] [client 128.187.97.6] Premature end of script headers: mySite.fcgi, referer: http://gallery.fernstenfamily.com/backend/upload/1/ [Wed Dec 21 09:47:05 2011] [error] mod_fcgid: process /home3/fernsten/public_html/ffamily/gallery/mySite.fcgi(22492) exit(communication error), get unex
1 #1 02-11-2010 22:37:38 zili Membre Registered: 02-11-2010 Posts: 1 Premature end of script headers: django.fcgi .htaccess:AddHandler fcgid-script .fcgi RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ django.fcgi/$1 [QSA,L]django.fcgi:#!/usr/bin/python import os, sys _PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, _PROJECT_DIR) sys.path.insert(0, os.path.dirname(_PROJECT_DIR)) _PROJECT_NAME = _PROJECT_DIR.split('/')[-1] os.environ['DJANGO_SETTINGS_MODULE'] = "%s.settings" % _PROJECT_NAME from django.core.servers.fastcgi import runfastcgi runfastcgi(method="threaded", daemonize="false")error.log:[Tue Nov 02 22:14:53 2010] [notice] Digest: generating secret for digest authentication ... [Tue Nov 02 22:14:53 2010] [notice] Digest: http://stackoverflow.com/questions/8593841/django-and-fcgi-and-mod-fcgid-errors done [Tue Nov 02 22:14:53 2010] [info] mod_fcgid: Process manager 2948147 started [Tue Nov 02 22:14:53 2010] [notice] Apache/2.2.16 (Debian) mod_fcgid/2.3.5 configured -- resuming normal operations [Tue Nov 02 22:14:53 2010] [info] Server built: Aug 31 2010 15:21:01 [Tue Nov 02 22:14:57 2010] [info] mod_fcgid: server alwaysdata:/home/ziliboba/chat/public/django.fcgi(2948272) started [Tue Nov 02 22:14:57 http://forum.alwaysdata.com/viewtopic.php?id=1210 2010] [warn] [client 80.239.242.95] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server [Tue Nov 02 22:14:57 2010] [error] [client 80.239.242.95] Premature end of script headers: django.fcgi [Tue Nov 02 22:14:58 2010] [info] mod_fcgid: server alwaysdata:/home/ziliboba/chat/public/django.fcgi(2948273) started [Tue Nov 02 22:14:58 2010] [warn] [client 80.239.242.95] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://ziliboba.alwaysdata.net/ [Tue Nov 02 22:14:58 2010] [error] [client 80.239.242.95] Premature end of script headers: django.fcgi, referer: http://ziliboba.alwaysdata.net/ [Tue Nov 02 22:15:01 2010] [info] mod_fcgid: process /home/ziliboba/chat/public/django.fcgi(2948273) exit(communication error), terminated by calling exit(), return code: 255 [Tue Nov 02 22:15:01 2010] [info] mod_fcgid: process /home/ziliboba/chat/public/django.fcgi(2948272) exit(communication error), terminated by calling exit(), return code: 255 Offline #2 29-11-2010 17:16:46 Garch Membre Registered: 29-11-2010 Posts: 2 Re: Premature end of script headers: django.fcgi J'ai suivi les instructions sur le wiki pour installer Django et j'ai exactement le probleme.error.log:[Mon Nov 29 17:11:39 2010] [notice] Digest: generating secret for digest authe
error reading data from FastCGI server [Solved](104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server 17 posts / 0 new Log in or register to post comments Last post #1 Tue, 02/26/2013 - 18:33 tazzydemon [Solved](104)Connection reset by peer: mod_fcgid: error reading data from FastCGI https://www.virtualmin.com/node/25539 server Sometimes when migrating sites are switching between mod_php and FCGId permissions can get mangled which cause errors such as: (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server when running in FCGId mode. I http://blog.dscpl.com.au/2011/09/why-is-wsgi-deployment-under-fastcgi-so.html found a solution to be ass follows. Go to /home/sitename/fcgi-bin Use the follpwoing command to reset the immutable flag "chattr -i php5.fcgi" Then delete the /home/sitename/etc and /home/sitename/fcgi-bin directories (making sure that anything that's not php related error reading in etc is saved) Using virtualmin switch back to apache mod_php mode and then back to FCGId mode. The site should now work Dont forget to chown any files/directories in public_html that were apache to : Note that these are both usually the sitename. Hope this helps Log in or register to post comments #2 Sat, 04/06/2013 - 00:25 cr0k Thanks a lot !!! Log in or register to post comments #3 Mon, 04/15/2013 - error reading data 11:24 p.romani@dgk.it Yes! Thanks! Log in or register to post comments #4 Sat, 04/27/2013 - 19:53 anjjriit @tazzydemon, sorry, i'm new user in virtualmin, I hope you explaint us more detil about step number 4. may be some screenshot ? Thanks in advance Log in or register to post comments #5 Thu, 10/10/2013 - 23:40 minhhoang I have similar symptom when upgrade from php 5.3 to 5.4. All pages are blank. Many thank tazzydemon, you save my life! I know it's late, anjjriit but for anybody else need in step 4: 1. Open virtualmin administrator page. 2. Select domain you want to change configuration's parameter. 3. Click "Server Configuration" 4. Click "Website Options" Regards, Minh Log in or register to post comments #6 Thu, 12/05/2013 - 21:44 cabriolas Ooohh yesssss!! Thank you tazzy :D Log in or register to post comments #7 Sat, 12/14/2013 - 11:22 Morpion Had some strange Apache errors with OwnCloud RPC, no more now :-) Created an account on virtualmin.com just now, just to thank you. Log in or register to post comments #8 Mon, 03/24/2014 - 17:08 -eclipse- Pro Licensee Work like a CHARM :) ThX Tim Log in or register to post comments #9 Sun, 04/13/2014 - 11:59 okinara I can see that this fix has worked for people eve for the last person whi
so that the general advice one often sees in relation to FASTCGI is that one should simply avoid it. In some cases people will go as far as justifying this by saying that FASTCGI is old technology and the cool kids aren't using it so you shouldn't either. What is reality here. Well, FASTCGI may be old technology but it does work. If it didn't work the bulk of the PHP web sites out there, which there are many many more of than Python web sites, would be falling over left, right and centre. They don't though, so the issue isn't FASTCGI but for Python at least it is the deployment experience. Put simply, PHP provides a simple deployment path where as no one has really gone out of there way to provide a pre canned FASTCGI integration for WSGI which service providers can set up easily and make the users life better. To try and understand where the problems lie I will go through the setup required for running a Python WSGI script under mod_fcgid, these days the preferred FASTCGI hosting solution for Apache. Unlike other blogs out there I am not just going to present the final recipe, but actually explain the pain points which people seem to encounter and why they arise. The FASTCGI Script In the case of Apache/mod_wsgi, all a user need do is drop a WSGI script file into a directory and either map a URL to it using the WSGIScriptAlias directive, or have it automatically mapped to based on its file system location and extension mapping provided by the AddHandler directive. A simple hello world WSGI script file suitable for Apache/mod_wsgi would be as follows. def application(environ, start_response): status = '200 OK' output = 'Hello World!' response_headers = [('Content-type', 'text/plain'), ('Content-Length', str(len(output)))] start_response(status, response_headers) return [output] Important to note here is that the WSGI script file only contains the WSGI application entry point which defines the programmatic API for communicating with the WSGI application. The WSGI script file does not say anything about how the WSGI application gets started or how requests are then passed off to it, this is the job of the hosting container (mod_wsgi) to manage. In contrast, for mod_fcgid, instead of a WSGI script file like above, it is necessary to provide an executable program. This program must start itself up and must have knowledge of how to communicate back to mod_fcgid across a socket using