This is my nginx errors in the error log.
2013/04/27 13:54:14 [error] # 0:14158 * 1 upstream closed prematurely FastCGI stdout while reading the response headers from upstream,
Client: W.X.Y.Z, server: sub.dom.com, the request: "GET/py - bin/hello. HTTP/1.1" py, upstream: "fastcgi://Unix:/var/run/fcgiwrap sockets:" the host: "sub.dom.com"
Py, bin location:/home/cluber/www/sub.dom.com/py-bin
For the position of the public_html:/home/cluber/www/sub.dom.com/public_html
Hello. The location of the py:/home/cluber/www/sub.dom.com/py-bin/hello.py (chmod 777)
Fastcgi_params location:/etc/nginx/fastcgi_params
The content of the nginx configuration
Server {
Server_name sub.dom.com;
Access_log/home/cluber/www/sub.dom.com/logs/access.log;
Error_log/home/cluber/www/sub.dom.com/logs/error.log;
Root/home/cluber/www/sub.dom.com/public_html;
Index index index. The HTML. HTML index. PHP/index. The PHP;
The location ~ \. PHP ${
Fastcgi_split_path_info ^ (. + \. PHP) (+)/. $;
Fastcgi_pass Unix:/var/run/php5 - FPM. The sock.
Fastcgi_index index. PHP;
The include fastcgi_params;
}
The location ~ ^/py - bin/. * \. Py ${
Gzip off;
Root/home/cluber/www/sub.dom.com;
Fastcgi_pass Unix:/var/run/fcgiwrap socket;
Fastcgi_index index. Py;
The include fastcgi_params;
}
}
The content of the fastcgi_params
Fastcgi_param QUERY_STRING $QUERY_STRING;
Fastcgi_param REQUEST_METHOD $REQUEST_METHOD;
Fastcgi_param CONTENT_TYPE $CONTENT_TYPE;
Fastcgi_param CONTENT_LENGTH $CONTENT_LENGTH;
Fastcgi_param SCRIPT_FILENAME $request_filename;
Fastcgi_param SCRIPT_NAME $fastcgi_script_name;
Fastcgi_param REQUEST_URI $REQUEST_URI;
Fastcgi_param DOCUMENT_URI $DOCUMENT_URI;
Fastcgi_param DOCUMENT_ROOT $DOCUMENT_ROOT;
Fastcgi_param SERVER_PROTOCOL $SERVER_PROTOCOL;
Fastcgi_param GATEWAY_INTERFACE CGI/1.1;
Fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
Fastcgi_param REMOTE_ADDR $REMOTE_ADDR;
Fastcgi_param REMOTE_PORT $REMOTE_PORT;
Fastcgi_param SERVER_ADDR $SERVER_ADDR;
Fastcgi_param SERVER_PORT $SERVER_PORT;
Fastcgi_param SERVER_NAME $SERVER_NAME;
Fastcgi_param HTTPS $HTTPS;
# PHP only required if PHP was built with - enable the -force - cgi - redirect
Fastcgi_param REDIRECT_STATUS 200;
The location of the socks:
The ls/var/run | grep sock
Fcgiwrap. Socket
Php5 - FPM. The sock
Hello. The content of the py
#! The/usr/bin/python
Print "content-type: text/HTML \ n \ n"
Print "Hello world"
Please note that the PHP working properly.
CodePudding user response:
Try to response code (" HTTP/1.0 200 OK ") is added to the hello. Py on top of the output, as shown in the following:#! The/usr/bin/python
Print "HTTP/1.0 200 OK"
Print "content-type: text/HTML \ n \ n"
Print "
"Print "Hello world"
CodePudding user response:
Fastcgi ports occupied, find your fastcgi process of port, kill the process, restart it